forked from OSchip/llvm-project
[mlir][Vector] Silence recently introduced warnings
This commit is contained in:
parent
82b74363a9
commit
a085c4b589
|
@ -26,16 +26,16 @@ struct MaskHelper {
|
|||
/// b01 captures the lower 2 bits, b67 captures the higher 2 bits.
|
||||
/// Meant to be used with instructions such as mm256ShufflePs.
|
||||
template <unsigned b67, unsigned b45, unsigned b23, unsigned b01>
|
||||
static char shuffle() {
|
||||
static int8_t shuffle() {
|
||||
static_assert(b01 <= 0x03, "overflow");
|
||||
static_assert(b23 <= 0x03, "overflow");
|
||||
static_assert(b45 <= 0x03, "overflow");
|
||||
static_assert(b67 <= 0x03, "overflow");
|
||||
return (b67 << 6) + (b45 << 4) + (b23 << 2) + b01;
|
||||
return static_cast<int8_t>((b67 << 6) | (b45 << 4) | (b23 << 2) | b01);
|
||||
}
|
||||
/// b01 captures the lower 2 bits, b67 captures the higher 2 bits.
|
||||
static void extractShuffle(char mask, char &b01, char &b23, char &b45,
|
||||
char &b67) {
|
||||
static void extractShuffle(int8_t mask, int8_t &b01, int8_t &b23, int8_t &b45,
|
||||
int8_t &b67) {
|
||||
b67 = (mask & (0x03 << 6)) >> 6;
|
||||
b45 = (mask & (0x03 << 4)) >> 4;
|
||||
b23 = (mask & (0x03 << 2)) >> 2;
|
||||
|
@ -44,13 +44,13 @@ struct MaskHelper {
|
|||
/// b03 captures the lower 4 bits, b47 captures the higher 4 bits.
|
||||
/// Meant to be used with instructions such as mm256Permute2f128Ps.
|
||||
template <unsigned b47, unsigned b03>
|
||||
static char permute() {
|
||||
static int8_t permute() {
|
||||
static_assert(b03 <= 0x0f, "overflow");
|
||||
static_assert(b47 <= 0x0f, "overflow");
|
||||
return (b47 << 4) + b03;
|
||||
return static_cast<int8_t>((b47 << 4) + b03);
|
||||
}
|
||||
/// b03 captures the lower 4 bits, b47 captures the higher 4 bits.
|
||||
static void extractPermute(char mask, char &b03, char &b47) {
|
||||
static void extractPermute(int8_t mask, int8_t &b03, int8_t &b47) {
|
||||
b47 = (mask & (0x0f << 4)) >> 4;
|
||||
b03 = mask & 0x0f;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Value mm256UnpackHiPs(ImplicitLocOpBuilder &b, Value v1, Value v2);
|
|||
/// Take an 8 bit mask, 2 bit for each position of a[0, 3) **and** b[0, 4):
|
||||
/// 0:127 | 128:255
|
||||
/// b01 b23 C8 D8 | b01+4 b23+4 C8+4 D8+4
|
||||
Value mm256ShufflePs(ImplicitLocOpBuilder &b, Value v1, Value v2, char mask);
|
||||
Value mm256ShufflePs(ImplicitLocOpBuilder &b, Value v1, Value v2, int8_t mask);
|
||||
|
||||
// imm[0:1] out of imm[0:3] is:
|
||||
// 0 1 2 3
|
||||
|
@ -89,7 +89,7 @@ Value mm256ShufflePs(ImplicitLocOpBuilder &b, Value v1, Value v2, char mask);
|
|||
// 0 1 2 3
|
||||
// imm[0:1] out of imm[4:7].
|
||||
Value mm256Permute2f128Ps(ImplicitLocOpBuilder &b, Value v1, Value v2,
|
||||
char mask);
|
||||
int8_t mask);
|
||||
|
||||
/// 4x8xf32-specific AVX2 transpose lowering.
|
||||
void transpose4x8xf32(ImplicitLocOpBuilder &ib, MutableArrayRef<Value> vs);
|
||||
|
|
|
@ -38,8 +38,8 @@ Value mlir::x86vector::avx2::mm256UnpackHiPs(ImplicitLocOpBuilder &b, Value v1,
|
|||
/// 0:127 | 128:255
|
||||
/// b01 b23 C8 D8 | b01+4 b23+4 C8+4 D8+4
|
||||
Value mlir::x86vector::avx2::mm256ShufflePs(ImplicitLocOpBuilder &b, Value v1,
|
||||
Value v2, char mask) {
|
||||
char b01, b23, b45, b67;
|
||||
Value v2, int8_t mask) {
|
||||
int8_t b01, b23, b45, b67;
|
||||
MaskHelper::extractShuffle(mask, b01, b23, b45, b67);
|
||||
SmallVector<int64_t> shuffleMask{b01, b23, b45 + 8, b67 + 8,
|
||||
b01 + 4, b23 + 4, b45 + 8 + 4, b67 + 8 + 4};
|
||||
|
@ -54,9 +54,9 @@ Value mlir::x86vector::avx2::mm256ShufflePs(ImplicitLocOpBuilder &b, Value v1,
|
|||
// imm[0:1] out of imm[4:7].
|
||||
Value mlir::x86vector::avx2::mm256Permute2f128Ps(ImplicitLocOpBuilder &b,
|
||||
Value v1, Value v2,
|
||||
char mask) {
|
||||
int8_t mask) {
|
||||
SmallVector<int64_t> shuffleMask;
|
||||
auto appendToMask = [&](char control) {
|
||||
auto appendToMask = [&](int8_t control) {
|
||||
if (control == 0)
|
||||
llvm::append_range(shuffleMask, ArrayRef<int64_t>{0, 1, 2, 3});
|
||||
else if (control == 1)
|
||||
|
@ -68,7 +68,7 @@ Value mlir::x86vector::avx2::mm256Permute2f128Ps(ImplicitLocOpBuilder &b,
|
|||
else
|
||||
llvm_unreachable("control > 3 : overflow");
|
||||
};
|
||||
char b03, b47;
|
||||
int8_t b03, b47;
|
||||
MaskHelper::extractPermute(mask, b03, b47);
|
||||
appendToMask(b03);
|
||||
appendToMask(b47);
|
||||
|
|
Loading…
Reference in New Issue