Skip to content

Commit 76a1b3a

Browse files
TianYe717Lukacma
authored andcommitted
[Headers][X86] Allow SLLDQ/SRLDQ byte shift intrinsics to be used in constexpr (llvm#164166)
Support constexpr usage for SLLDQ/SRLDQ byte shift intrinsics This draft PR adds support for using the following SRLDQ intrinsics in constant expressions: - _mm_srli_si128 - _mm256_srli_si256 - _mm_slli_si128 - _mm256_slli_si256 Relevant tests are included. Fixes llvm#156494
1 parent b80e9cd commit 76a1b3a

File tree

6 files changed

+146
-4
lines changed

6 files changed

+146
-4
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ let Features = "sse2", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] i
280280
def psllw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
281281
def pslld128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">;
282282
def psllq128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>)">;
283-
def pslldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
284-
def psrldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
285283
}
286284

287285
let Features = "sse2",
@@ -300,6 +298,9 @@ let Features = "sse2",
300298

301299
def psrawi128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, int)">;
302300
def psradi128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, int)">;
301+
302+
def pslldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
303+
def psrldqi128_byteshift : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Constant int)">;
303304
}
304305

305306
let Features = "sse3", Attributes = [NoThrow] in {
@@ -607,12 +608,10 @@ let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] i
607608
: X86Builtin<
608609
"_Vector<4, long long int>(_Vector<32, char>, _Vector<32, char>)">;
609610
def psllw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
610-
def pslldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
611611
def pslld256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
612612
def psllq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>)">;
613613
def psraw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
614614
def psrad256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
615-
def psrldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
616615
def psrlw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<8, short>)">;
617616
def psrld256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>)">;
618617
def psrlq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<2, long long int>)">;
@@ -646,10 +645,12 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
646645
def psllwi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
647646
def pslldi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
648647
def psllqi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, int)">;
648+
def pslldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
649649

650650
def psrlwi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
651651
def psrldi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
652652
def psrlqi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, int)">;
653+
def psrldqi256_byteshift : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Constant int)">;
653654

654655
def psrawi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
655656
def psradi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
@@ -2090,6 +2091,9 @@ let Features = "avx512bw", Attributes = [NoThrow, Const, RequiredVectorWidth<512
20902091
: X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<8, short>)">;
20912092
def psrlw512
20922093
: X86Builtin<"_Vector<32, short>(_Vector<32, short>, _Vector<8, short>)">;
2094+
}
2095+
2096+
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
20932097
def pslldqi512_byteshift : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Constant int)">;
20942098
def psrldqi512_byteshift : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Constant int)">;
20952099
}

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,6 +3320,38 @@ static bool interp__builtin_ia32_vpconflict(InterpState &S, CodePtr OpPC,
33203320
return true;
33213321
}
33223322

3323+
static bool interp__builtin_x86_byteshift(
3324+
InterpState &S, CodePtr OpPC, const CallExpr *Call, unsigned ID,
3325+
llvm::function_ref<APInt(const Pointer &, unsigned Lane, unsigned I,
3326+
unsigned Shift)>
3327+
Fn) {
3328+
assert(Call->getNumArgs() == 2);
3329+
3330+
APSInt ImmAPS = popToAPSInt(S, Call->getArg(1));
3331+
uint64_t Shift = ImmAPS.getZExtValue() & 0xff;
3332+
3333+
const Pointer &Src = S.Stk.pop<Pointer>();
3334+
if (!Src.getFieldDesc()->isPrimitiveArray())
3335+
return false;
3336+
3337+
unsigned NumElems = Src.getNumElems();
3338+
const Pointer &Dst = S.Stk.peek<Pointer>();
3339+
PrimType ElemT = Src.getFieldDesc()->getPrimType();
3340+
3341+
for (unsigned Lane = 0; Lane != NumElems; Lane += 16) {
3342+
for (unsigned I = 0; I != 16; ++I) {
3343+
unsigned Base = Lane + I;
3344+
APSInt Result = APSInt(Fn(Src, Lane, I, Shift));
3345+
INT_TYPE_SWITCH_NO_BOOL(ElemT,
3346+
{ Dst.elem<T>(Base) = static_cast<T>(Result); });
3347+
}
3348+
}
3349+
3350+
Dst.initializeAllElements();
3351+
3352+
return true;
3353+
}
3354+
33233355
bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
33243356
uint32_t BuiltinID) {
33253357
if (!S.getASTContext().BuiltinInfo.isConstantEvaluated(BuiltinID))
@@ -4390,6 +4422,39 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
43904422
case X86::BI__builtin_ia32_vec_set_v4di:
43914423
return interp__builtin_vec_set(S, OpPC, Call, BuiltinID);
43924424

4425+
case X86::BI__builtin_ia32_pslldqi128_byteshift:
4426+
case X86::BI__builtin_ia32_pslldqi256_byteshift:
4427+
case X86::BI__builtin_ia32_pslldqi512_byteshift:
4428+
// These SLLDQ intrinsics always operate on byte elements (8 bits).
4429+
// The lane width is hardcoded to 16 to match the SIMD register size,
4430+
// but the algorithm processes one byte per iteration,
4431+
// so APInt(8, ...) is correct and intentional.
4432+
return interp__builtin_x86_byteshift(
4433+
S, OpPC, Call, BuiltinID,
4434+
[](const Pointer &Src, unsigned Lane, unsigned I, unsigned Shift) {
4435+
if (I < Shift) {
4436+
return APInt(8, 0);
4437+
}
4438+
return APInt(8, Src.elem<uint8_t>(Lane + I - Shift));
4439+
});
4440+
4441+
case X86::BI__builtin_ia32_psrldqi128_byteshift:
4442+
case X86::BI__builtin_ia32_psrldqi256_byteshift:
4443+
case X86::BI__builtin_ia32_psrldqi512_byteshift:
4444+
// These SRLDQ intrinsics always operate on byte elements (8 bits).
4445+
// The lane width is hardcoded to 16 to match the SIMD register size,
4446+
// but the algorithm processes one byte per iteration,
4447+
// so APInt(8, ...) is correct and intentional.
4448+
return interp__builtin_x86_byteshift(
4449+
S, OpPC, Call, BuiltinID,
4450+
[](const Pointer &Src, unsigned Lane, unsigned I, unsigned Shift) {
4451+
if (I + Shift < 16) {
4452+
return APInt(8, Src.elem<uint8_t>(Lane + I + Shift));
4453+
}
4454+
4455+
return APInt(8, 0);
4456+
});
4457+
43934458
default:
43944459
S.FFDiag(S.Current->getLocation(OpPC),
43954460
diag::note_invalid_subexpr_in_const_expr)

clang/lib/AST/ExprConstant.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12906,6 +12906,66 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1290612906

1290712907
return Success(APValue(Elems.data(), NumElems), E);
1290812908
}
12909+
12910+
case X86::BI__builtin_ia32_pslldqi128_byteshift:
12911+
case X86::BI__builtin_ia32_pslldqi256_byteshift:
12912+
case X86::BI__builtin_ia32_pslldqi512_byteshift: {
12913+
assert(E->getNumArgs() == 2);
12914+
12915+
APValue Src;
12916+
APSInt Imm;
12917+
if (!EvaluateAsRValue(Info, E->getArg(0), Src) ||
12918+
!EvaluateInteger(E->getArg(1), Imm, Info))
12919+
return false;
12920+
12921+
unsigned VecLen = Src.getVectorLength();
12922+
unsigned Shift = Imm.getZExtValue() & 0xff;
12923+
12924+
SmallVector<APValue> ResultElements;
12925+
for (unsigned Lane = 0; Lane != VecLen; Lane += 16) {
12926+
for (unsigned I = 0; I != 16; ++I) {
12927+
if (I < Shift) {
12928+
APSInt Zero(8, /*isUnsigned=*/true);
12929+
Zero = 0;
12930+
ResultElements.push_back(APValue(Zero));
12931+
} else {
12932+
ResultElements.push_back(Src.getVectorElt(Lane + I - Shift));
12933+
}
12934+
}
12935+
}
12936+
12937+
return Success(APValue(ResultElements.data(), ResultElements.size()), E);
12938+
}
12939+
12940+
case X86::BI__builtin_ia32_psrldqi128_byteshift:
12941+
case X86::BI__builtin_ia32_psrldqi256_byteshift:
12942+
case X86::BI__builtin_ia32_psrldqi512_byteshift: {
12943+
assert(E->getNumArgs() == 2);
12944+
12945+
APValue Src;
12946+
APSInt Imm;
12947+
if (!EvaluateAsRValue(Info, E->getArg(0), Src) ||
12948+
!EvaluateInteger(E->getArg(1), Imm, Info))
12949+
return false;
12950+
12951+
unsigned VecLen = Src.getVectorLength();
12952+
unsigned Shift = Imm.getZExtValue() & 0xff;
12953+
12954+
SmallVector<APValue> ResultElements;
12955+
for (unsigned Lane = 0; Lane != VecLen; Lane += 16) {
12956+
for (unsigned I = 0; I != 16; ++I) {
12957+
if (I + Shift < 16) {
12958+
ResultElements.push_back(Src.getVectorElt(Lane + I + Shift));
12959+
} else {
12960+
APSInt Zero(8, /*isUnsigned=*/true);
12961+
Zero = 0;
12962+
ResultElements.push_back(APValue(Zero));
12963+
}
12964+
}
12965+
}
12966+
12967+
return Success(APValue(ResultElements.data(), ResultElements.size()), E);
12968+
}
1290912969
}
1291012970
}
1291112971

clang/test/CodeGen/X86/avx2-builtins.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,8 @@ __m256i test_mm256_slli_si256(__m256i a) {
12361236
// CHECK: shufflevector <32 x i8> zeroinitializer, <32 x i8> %{{.*}}, <32 x i32> <i32 13, i32 14, i32 15, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 29, i32 30, i32 31, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60>
12371237
return _mm256_slli_si256(a, 3);
12381238
}
1239+
TEST_CONSTEXPR(match_v32qi(_mm256_slli_si256(((__m256i)(__v32qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}), 3), 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29));
1240+
TEST_CONSTEXPR(match_v32qi(_mm256_slli_si256(((__m256i)(__v32qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
12391241

12401242
__m128i test_mm_sllv_epi32(__m128i a, __m128i b) {
12411243
// CHECK-LABEL: test_mm_sllv_epi32
@@ -1379,6 +1381,8 @@ __m256i test_mm256_srli_si256(__m256i a) {
13791381
// CHECK: shufflevector <32 x i8> %{{.*}}, <32 x i8> zeroinitializer, <32 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 32, i32 33, i32 34, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 48, i32 49, i32 50>
13801382
return _mm256_srli_si256(a, 3);
13811383
}
1384+
TEST_CONSTEXPR(match_v32qi(_mm256_srli_si256(((__m256i)(__v32qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}), 3), 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 0));
1385+
TEST_CONSTEXPR(match_v32qi(_mm256_srli_si256(((__m256i)(__v32qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
13821386

13831387
__m128i test_mm_srlv_epi32(__m128i a, __m128i b) {
13841388
// CHECK-LABEL: test_mm_srlv_epi32

clang/test/CodeGen/X86/avx512bw-builtins.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,6 +2045,8 @@ __m512i test_mm512_bslli_epi128(__m512i __A) {
20452045
// CHECK: shufflevector <64 x i8> zeroinitializer, <64 x i8> %{{.*}}, <64 x i32> <i32 11, i32 12, i32 13, i32 14, i32 15, i32 64, i32 65, i32 66, i32 67, i32 68, i32 69, i32 70, i32 71, i32 72, i32 73, i32 74, i32 27, i32 28, i32 29, i32 30, i32 31, i32 80, i32 81, i32 82, i32 83, i32 84, i32 85, i32 86, i32 87, i32 88, i32 89, i32 90, i32 43, i32 44, i32 45, i32 46, i32 47, i32 96, i32 97, i32 98, i32 99, i32 100, i32 101, i32 102, i32 103, i32 104, i32 105, i32 106, i32 59, i32 60, i32 61, i32 62, i32 63, i32 112, i32 113, i32 114, i32 115, i32 116, i32 117, i32 118, i32 119, i32 120, i32 121, i32 122>
20462046
return _mm512_bslli_epi128(__A, 5);
20472047
}
2048+
TEST_CONSTEXPR(match_v64qi(_mm512_bslli_epi128(((__m512i)(__v64qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}), 5), 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, 0, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 0, 0, 0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59));
2049+
TEST_CONSTEXPR(match_v64qi(_mm512_bslli_epi128(((__m512i)(__v64qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
20482050

20492051
__m512i test_mm512_srlv_epi16(__m512i __A, __m512i __B) {
20502052
// CHECK-LABEL: test_mm512_srlv_epi16
@@ -2223,6 +2225,9 @@ __m512i test_mm512_bsrli_epi128(__m512i __A) {
22232225
// CHECK: shufflevector <64 x i8> %{{.*}}, <64 x i8> zeroinitializer, <64 x i32> <i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 64, i32 65, i32 66, i32 67, i32 68, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 80, i32 81, i32 82, i32 83, i32 84, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 96, i32 97, i32 98, i32 99, i32 100, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63, i32 112, i32 113, i32 114, i32 115, i32 116>
22242226
return _mm512_bsrli_epi128(__A, 5);
22252227
}
2228+
TEST_CONSTEXPR(match_v64qi(_mm512_bsrli_epi128(((__m512i)(__v64qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}), 5), 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, 0, 0, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0));
2229+
TEST_CONSTEXPR(match_v64qi(_mm512_bsrli_epi128(((__m512i)(__v64qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
2230+
22262231
__m512i test_mm512_mask_mov_epi16(__m512i __W, __mmask32 __U, __m512i __A) {
22272232
// CHECK-LABEL: test_mm512_mask_mov_epi16
22282233
// CHECK: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}

clang/test/CodeGen/X86/sse2-builtins.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,8 @@ __m128i test_mm_slli_si128(__m128i A) {
14181418
// CHECK: shufflevector <16 x i8> zeroinitializer, <16 x i8> %{{.*}}, <16 x i32> <i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26>
14191419
return _mm_slli_si128(A, 5);
14201420
}
1421+
TEST_CONSTEXPR(match_v16qi(_mm_slli_si128(((__m128i)(__v16qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}), 5), 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
1422+
TEST_CONSTEXPR(match_v16qi(_mm_slli_si128(((__m128i)(__v16qi){1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
14211423

14221424
__m128i test_mm_slli_si128_2(__m128i A) {
14231425
// CHECK-LABEL: test_mm_slli_si128_2
@@ -1570,6 +1572,8 @@ __m128i test_mm_srli_si128(__m128i A) {
15701572
// CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> zeroinitializer, <16 x i32> <i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20>
15711573
return _mm_srli_si128(A, 5);
15721574
}
1575+
TEST_CONSTEXPR(match_v16qi(_mm_srli_si128(((__m128i)(__v16qi){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), 5), 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0));
1576+
TEST_CONSTEXPR(match_v16qi(_mm_srli_si128(((__m128i)(__v16qi){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}), 16), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
15731577

15741578
__m128i test_mm_srli_si128_2(__m128i A) {
15751579
// CHECK-LABEL: test_mm_srli_si128_2

0 commit comments

Comments
 (0)