Skip to content

Commit 98e2765

Browse files
committed
[CIR][CIRGen][Builtin][X86] Lower remaining AVX masked load intrinsics
1 parent 8f89224 commit 98e2765

File tree

8 files changed

+641
-3
lines changed

8 files changed

+641
-3
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,34 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
894894
return CIRBaseBuilderTy::createStore(loc, flag, dst);
895895
}
896896

897+
/// Create a call to a Masked Load intrinsic.
898+
/// \p loc - expression location
899+
/// \p ty - vector type to load
900+
/// \p ptr - base pointer for the load
901+
/// \p alignment - alignment of the source location
902+
/// \p mask - vector of booleans which indicates what vector lanes should
903+
/// be accessed in memory
904+
/// \p passThru - pass-through value that is used to fill the masked-off
905+
/// lanes
906+
/// of the result
907+
mlir::Value createMaskedLoad(mlir::Location loc, mlir::Type ty,
908+
mlir::Value ptr, llvm::Align alignment,
909+
mlir::Value mask, mlir::Value passThru) {
910+
911+
assert(mlir::isa<cir::VectorType>(ty) && "Type should be vector");
912+
assert(mask && "Mask should not be all-ones (null)");
913+
914+
if (!passThru)
915+
passThru = this->getConstant(loc, cir::PoisonAttr::get(ty));
916+
917+
mlir::Value ops[] = {ptr, this->getUInt32(int32_t(alignment.value()), loc),
918+
mask, passThru};
919+
920+
return create<cir::LLVMIntrinsicCallOp>(loc, getStringAttr("masked.load"),
921+
ty, ops)
922+
.getResult();
923+
}
924+
897925
/// Create a call to a masked store intrinsic.
898926
/// \p loc - expression location
899927
/// \p val - data to be stored

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ static mlir::Value emitX86MaskedStore(CIRGenFunction &cgf,
108108
maskVec);
109109
}
110110

111+
static mlir::Value emitX86MaskedLoad(CIRGenFunction &cgf,
112+
ArrayRef<mlir::Value> ops,
113+
llvm::Align alignment,
114+
mlir::Location loc) {
115+
mlir::Type ty = ops[1].getType();
116+
mlir::Value ptr = ops[0];
117+
mlir::Value maskVec =
118+
getMaskVecValue(cgf, ops[2], cast<cir::VectorType>(ty).getSize(), loc);
119+
120+
return cgf.getBuilder().createMaskedLoad(loc, ty, ptr, alignment, maskVec,
121+
ops[1]);
122+
}
123+
111124
static mlir::Value emitX86SExtMask(CIRGenFunction &cgf, mlir::Value op,
112125
mlir::Type dstTy, mlir::Location loc) {
113126
unsigned numberOfElements = cast<cir::VectorType>(dstTy).getSize();
@@ -588,13 +601,15 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID,
588601
case X86::BI__builtin_ia32_loaddqudi128_mask:
589602
case X86::BI__builtin_ia32_loaddqudi256_mask:
590603
case X86::BI__builtin_ia32_loaddqudi512_mask:
591-
llvm_unreachable("vfmaddsubph256_round_mask3 NYI");
604+
return emitX86MaskedLoad(*this, Ops, llvm::Align(1),
605+
getLoc(E->getExprLoc()));
592606

593607
case X86::BI__builtin_ia32_loadsbf16128_mask:
594608
case X86::BI__builtin_ia32_loadsh128_mask:
595609
case X86::BI__builtin_ia32_loadss128_mask:
596610
case X86::BI__builtin_ia32_loadsd128_mask:
597-
llvm_unreachable("vfmaddsubph256_round_mask3 NYI");
611+
return emitX86MaskedLoad(*this, Ops, llvm::Align(1),
612+
getLoc(E->getExprLoc()));
598613

599614
case X86::BI__builtin_ia32_loadaps128_mask:
600615
case X86::BI__builtin_ia32_loadaps256_mask:
@@ -608,7 +623,10 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID,
608623
case X86::BI__builtin_ia32_movdqa64load128_mask:
609624
case X86::BI__builtin_ia32_movdqa64load256_mask:
610625
case X86::BI__builtin_ia32_movdqa64load512_mask:
611-
llvm_unreachable("vfmaddsubph256_round_mask3 NYI");
626+
return emitX86MaskedLoad(
627+
*this, Ops,
628+
getContext().getTypeAlignInChars(E->getArg(1)->getType()).getAsAlign(),
629+
getLoc(E->getExprLoc()));
612630

613631
case X86::BI__builtin_ia32_expandloaddf128_mask:
614632
case X86::BI__builtin_ia32_expandloaddf256_mask:

clang/test/CIR/CodeGen/X86/avx10_2bf16-builtins.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,21 @@ void test_mm_mask_store_sbh(void *__P, __mmask8 __U, __m128bh __A) {
1313
// LLVM: call void @llvm.masked.store.v8bf16.p0(<8 x bfloat> %{{.*}}, ptr %{{.*}}, i32 1, <8 x i1> %{{.*}})
1414
_mm_mask_store_sbh(__P, __U, __A);
1515
}
16+
17+
__m128bh test_mm_load_sbh(void const *A) {
18+
// CIR-LABEL: _mm_load_sbh
19+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.bf16 x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.bf16 x 8>) -> !cir.vector<!cir.bf16 x 8>
20+
21+
// LLVM-LABEL: @test_mm_load_sbh
22+
// LLVM: %{{.*}} = call <8 x bfloat> @llvm.masked.load.v8bf16.p0(ptr %{{.*}}, i32 1, <8 x i1> <i1 true, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false>, <8 x bfloat> %{{.*}})
23+
return _mm_load_sbh(A);
24+
}
25+
26+
__m128bh test_mm_mask_load_sbh(__m128bh __A, __mmask8 __U, const void *__W) {
27+
// CIR-LABEL: _mm_mask_load_sbh
28+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.bf16 x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.bf16 x 8>) -> !cir.vector<!cir.bf16 x 8>
29+
30+
// LLVM-LABEL: @test_mm_mask_load_sbh
31+
// LLVM: %{{.*}} = call <8 x bfloat> @llvm.masked.load.v8bf16.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x bfloat> %{{.*}})
32+
return _mm_mask_load_sbh(__A, __U, __W);
33+
}

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,39 @@ __m512i test_mm512_movm_epi16(__mmask32 __A) {
3737
// LLVM: %{{.*}} = sext <32 x i1> %{{.*}} to <32 x i16>
3838
return _mm512_movm_epi16(__A);
3939
}
40+
41+
__m512i test_mm512_mask_loadu_epi8(__m512i __W, __mmask64 __U, void const *__P) {
42+
// CIR-LABEL: _mm512_mask_loadu_epi8
43+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<{{!s8i|!u8i}} x 64>>, !u32i, !cir.vector<!cir.int<s, 1> x 64>, !cir.vector<{{!s8i|!u8i}} x 64>) -> !cir.vector<{{!s8i|!u8i}} x 64>
44+
45+
// LLVM-LABEL: @test_mm512_mask_loadu_epi8
46+
// LLVM: @llvm.masked.load.v64i8.p0(ptr %{{.*}}, i32 1, <64 x i1> %{{.*}}, <64 x i8> %{{.*}})
47+
return _mm512_mask_loadu_epi8(__W, __U, __P);
48+
}
49+
50+
__m512i test_mm512_mask_loadu_epi16(__m512i __W, __mmask32 __U, void const *__P) {
51+
// CIR-LABEL: _mm512_mask_loadu_epi16
52+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!s16i x 32>>, !u32i, !cir.vector<!cir.int<s, 1> x 32>, !cir.vector<!s16i x 32>) -> !cir.vector<!s16i x 32>
53+
54+
// LLVM-LABEL: @test_mm512_mask_loadu_epi16
55+
// LLVM: @llvm.masked.load.v32i16.p0(ptr %{{.*}}, i32 1, <32 x i1> %{{.*}}, <32 x i16> %{{.*}})
56+
return _mm512_mask_loadu_epi16(__W, __U, __P);
57+
}
58+
59+
__m512i test_mm512_maskz_loadu_epi16(__mmask32 __U, void const *__P) {
60+
// CIR-LABEL: _mm512_maskz_loadu_epi16
61+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!s16i x 32>>, !u32i, !cir.vector<!cir.int<s, 1> x 32>, !cir.vector<!s16i x 32>) -> !cir.vector<!s16i x 32>
62+
63+
// LLVM-LABEL: @test_mm512_maskz_loadu_epi16
64+
// LLVM: @llvm.masked.load.v32i16.p0(ptr %{{.*}}, i32 1, <32 x i1> %{{.*}}, <32 x i16> %{{.*}})
65+
return _mm512_maskz_loadu_epi16(__U, __P);
66+
}
67+
68+
__m512i test_mm512_maskz_loadu_epi8(__mmask64 __U, void const *__P) {
69+
// CIR-LABEL: _mm512_maskz_loadu_epi8
70+
// CIR: cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<{{!s8i|!u8i}} x 64>>, !u32i, !cir.vector<!cir.int<s, 1> x 64>, !cir.vector<{{!s8i|!u8i}} x 64>) -> !cir.vector<{{!s8i|!u8i}} x 64>
71+
72+
// LLVM-LABEL: @test_mm512_maskz_loadu_epi8
73+
// LLVM: @llvm.masked.load.v64i8.p0(ptr %{{.*}}, i32 1, <64 x i1> %{{.*}}, <64 x i8> %{{.*}})
74+
return _mm512_maskz_loadu_epi8(__U, __P);
75+
}

clang/test/CIR/CodeGen/X86/avx512f-builtins.c

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,171 @@ void test_mm_mask_store_sd(double * __P, __mmask8 __U, __m128d __A){
4646
// LLVM: call void @llvm.masked.store.v2f64.p0(<2 x double> %{{.*}}, ptr %{{.*}}, i32 1, <2 x i1> %{{.*}})
4747
_mm_mask_store_sd(__P, __U, __A);
4848
}
49+
__m512 test_mm512_mask_loadu_ps (__m512 __W, __mmask16 __U, void *__P)
50+
{
51+
// CIR-LABEL: _mm512_mask_loadu_ps
52+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.float>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!cir.float x 16>) -> !cir.vector<!cir.float x 16>
53+
54+
// LLVM-LABEL: test_mm512_mask_loadu_ps
55+
// LLVM: @llvm.masked.load.v16f32.p0(ptr %{{.*}}, i32 1, <16 x i1> %{{.*}}, <16 x float> %{{.*}})
56+
return _mm512_mask_loadu_ps (__W,__U, __P);
57+
}
58+
59+
__m512 test_mm512_maskz_load_ps(__mmask16 __U, void *__P)
60+
{
61+
62+
// CIR-LABEL: _mm512_maskz_load_ps
63+
// CIR: cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.float x 16>>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!cir.float x 16>) -> !cir.vector<!cir.float x 16>
64+
65+
// LLVM-LABEL: test_mm512_maskz_load_ps
66+
// LLVM: @llvm.masked.load.v16f32.p0(ptr %{{.*}}, i32 64, <16 x i1> %{{.*}}, <16 x float> %{{.*}})
67+
return _mm512_maskz_load_ps(__U, __P);
68+
}
69+
70+
__m512d test_mm512_mask_loadu_pd (__m512d __W, __mmask8 __U, void *__P)
71+
{
72+
// CIR-LABEL: _mm512_mask_loadu_pd
73+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.double>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.double x 8>) -> !cir.vector<!cir.double x 8>
74+
75+
// LLVM-LABEL: test_mm512_mask_loadu_pd
76+
// LLVM: @llvm.masked.load.v8f64.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x double> %{{.*}})
77+
return _mm512_mask_loadu_pd (__W,__U, __P);
78+
}
79+
80+
__m512d test_mm512_maskz_load_pd(__mmask8 __U, void *__P)
81+
{
82+
// CIR-LABEL: _mm512_maskz_load_pd
83+
// CIR: cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.double x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.double x 8>) -> !cir.vector<!cir.double x 8>
84+
85+
// LLVM-LABEL: test_mm512_maskz_load_pd
86+
// LLVM: @llvm.masked.load.v8f64.p0(ptr %{{.*}}, i32 64, <8 x i1> %{{.*}}, <8 x double> %{{.*}})
87+
return _mm512_maskz_load_pd(__U, __P);
88+
}
89+
90+
__m512i test_mm512_mask_loadu_epi32 (__m512i __W, __mmask16 __U, void *__P)
91+
{
92+
// CIR-LABEL: _mm512_mask_loadu_epi32
93+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!s32i>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!s32i x 16>) -> !cir.vector<!s32i x 16>
94+
95+
// LLVM-LABEL: test_mm512_mask_loadu_epi32
96+
// LLVM: @llvm.masked.load.v16i32.p0(ptr %{{.*}}, i32 1, <16 x i1> %{{.*}}, <16 x i32> %{{.*}})
97+
return _mm512_mask_loadu_epi32 (__W,__U, __P);
98+
}
99+
100+
__m512i test_mm512_maskz_loadu_epi32 (__mmask16 __U, void *__P)
101+
{
102+
// CIR-LABEL: _mm512_maskz_loadu_epi32
103+
// CIR: cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!s32i>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!s32i x 16>) -> !cir.vector<!s32i x 16>
104+
105+
// LLVM-LABEL: test_mm512_maskz_loadu_epi32
106+
// LLVM: @llvm.masked.load.v16i32.p0(ptr %{{.*}}, i32 1, <16 x i1> %{{.*}}, <16 x i32> %{{.*}})
107+
return _mm512_maskz_loadu_epi32 (__U, __P);
108+
}
109+
110+
__m512i test_mm512_mask_loadu_epi64 (__m512i __W, __mmask8 __U, void *__P)
111+
{
112+
// CIR-LABEL: _mm512_mask_loadu_epi64
113+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!s64i>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!s64i x 8>) -> !cir.vector<!s64i x 8>
114+
115+
// LLVM-LABEL: test_mm512_mask_loadu_epi64
116+
// LLVM: @llvm.masked.load.v8i64.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x i64> %{{.*}})
117+
return _mm512_mask_loadu_epi64 (__W,__U, __P);
118+
}
119+
120+
__m512i test_mm512_maskz_loadu_epi64 (__mmask16 __U, void *__P)
121+
{
122+
// CIR-LABEL: _mm512_maskz_loadu_epi64
123+
// CIR: cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!s64i>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!s64i x 8>) -> !cir.vector<!s64i x 8>
124+
125+
// LLVM-LABEL: test_mm512_maskz_loadu_epi64
126+
// LLVM: @llvm.masked.load.v8i64.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x i64> %{{.*}})
127+
return _mm512_maskz_loadu_epi64 (__U, __P);
128+
}
129+
130+
__m128 test_mm_mask_load_ss(__m128 __A, __mmask8 __U, const float* __W)
131+
{
132+
// CIR-LABEL: _mm_mask_load_ss
133+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.float x 4>>, !u32i, !cir.vector<!cir.int<s, 1> x 4>, !cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
134+
135+
// LLVM-LABEL: test_mm_mask_load_ss
136+
// LLVM: call {{.*}}<4 x float> @llvm.masked.load.v4f32.p0(ptr %{{.*}}, i32 1, <4 x i1> %{{.*}}, <4 x float> %{{.*}})
137+
return _mm_mask_load_ss(__A, __U, __W);
138+
}
139+
140+
__m128 test_mm_maskz_load_ss (__mmask8 __U, const float * __W)
141+
{
142+
// CIR-LABEL: _mm_maskz_load_ss
143+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.float x 4>>, !u32i, !cir.vector<!cir.int<s, 1> x 4>, !cir.vector<!cir.float x 4>) -> !cir.vector<!cir.float x 4>
144+
145+
// LLVM-LABEL: test_mm_maskz_load_ss
146+
// LLVM: call {{.*}}<4 x float> @llvm.masked.load.v4f32.p0(ptr %{{.*}}, i32 1, <4 x i1> %{{.*}}, <4 x float> %{{.*}})
147+
return _mm_maskz_load_ss (__U, __W);
148+
}
149+
150+
__m128d test_mm_mask_load_sd (__m128d __A, __mmask8 __U, const double * __W)
151+
{
152+
// CIR-LABEL: _mm_mask_load_sd
153+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.double x 2>>, !u32i, !cir.vector<!cir.int<s, 1> x 2>, !cir.vector<!cir.double x 2>) -> !cir.vector<!cir.double x 2>
154+
155+
// LLVM-LABEL: test_mm_mask_load_sd
156+
// LLVM: call {{.*}}<2 x double> @llvm.masked.load.v2f64.p0(ptr %{{.*}}, i32 1, <2 x i1> %{{.*}}, <2 x double> %{{.*}})
157+
return _mm_mask_load_sd (__A, __U, __W);
158+
}
159+
160+
__m128d test_mm_maskz_load_sd (__mmask8 __U, const double * __W)
161+
{
162+
// CIR-LABEL: _mm_maskz_load_sd
163+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.double x 2>>, !u32i, !cir.vector<!cir.int<s, 1> x 2>, !cir.vector<!cir.double x 2>) -> !cir.vector<!cir.double x 2>
164+
165+
// LLVM-LABEL: test_mm_maskz_load_sd
166+
// LLVM: call {{.*}}<2 x double> @llvm.masked.load.v2f64.p0(ptr %{{.*}}, i32 1, <2 x i1> %{{.*}}, <2 x double> %{{.*}})
167+
return _mm_maskz_load_sd (__U, __W);
168+
}
169+
170+
__m512 test_mm512_mask_load_ps (__m512 __W, __mmask16 __U, void *__P)
171+
{
172+
// CIR-LABEL: _mm512_mask_load_ps
173+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.float x 16>>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!cir.float x 16>) -> !cir.vector<!cir.float x 16>
174+
175+
// LLVM-LABEL: test_mm512_mask_load_ps
176+
// LLVM: @llvm.masked.load.v16f32.p0(ptr %{{.*}}, i32 64, <16 x i1> %{{.*}}, <16 x float> %{{.*}})
177+
return _mm512_mask_load_ps (__W,__U, __P);
178+
}
179+
180+
__m512d test_mm512_mask_load_pd (__m512d __W, __mmask8 __U, void *__P)
181+
{
182+
// CIR-LABEL: _mm512_mask_load_pd
183+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.double x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.double x 8>) -> !cir.vector<!cir.double x 8>
184+
185+
// LLVM-LABEL: test_mm512_mask_load_pd
186+
// LLVM: @llvm.masked.load.v8f64.p0(ptr %{{.*}}, i32 64, <8 x i1> %{{.*}}, <8 x double> %{{.*}})
187+
return _mm512_mask_load_pd (__W,__U, __P);
188+
}
189+
190+
__m512i test_mm512_mask_load_epi32(__m512i __W, __mmask16 __U, void const *__P) {
191+
// CIR-LABEL: _mm512_mask_load_epi32
192+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!s32i x 16>>, !u32i, !cir.vector<!cir.int<s, 1> x 16>, !cir.vector<!s32i x 16>) -> !cir.vector<!s32i x 16>
193+
194+
// LLVM-LABEL: test_mm512_mask_load_epi32
195+
// LLVM: @llvm.masked.load.v16i32.p0(ptr %{{.*}}, i32 64, <16 x i1> %{{.*}}, <16 x i32> %{{.*}})
196+
return _mm512_mask_load_epi32(__W, __U, __P);
197+
}
198+
199+
__m512i test_mm512_mask_load_epi64(__m512i __W, __mmask8 __U, void const *__P) {
200+
// CIR-LABEL: _mm512_mask_load_epi64
201+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!s64i x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!s64i x 8>) -> !cir.vector<!s64i x 8>
202+
203+
// LLVM-LABEL: test_mm512_mask_load_epi64
204+
// LLVM: @llvm.masked.load.v8i64.p0(ptr %{{.*}}, i32 64, <8 x i1> %{{.*}}, <8 x i64> %{{.*}})
205+
return _mm512_mask_load_epi64(__W, __U, __P);
206+
}
207+
208+
__m512i test_mm512_maskz_load_epi64(__mmask8 __U, void const *__P) {
209+
// CIR-LABEL: _mm512_maskz_load_epi64
210+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!s64i x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!s64i x 8>) -> !cir.vector<!s64i x 8>
211+
212+
// LLVM-LABEL: test_mm512_maskz_load_epi64
213+
// LLVM: @llvm.masked.load.v8i64.p0(ptr %{{.*}}, i32 64, <8 x i1> %{{.*}}, <8 x i64> %{{.*}})
214+
return _mm512_maskz_load_epi64(__U, __P);
215+
}
216+

clang/test/CIR/CodeGen/X86/avx512fp16-builtins.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,21 @@ void test_mm_mask_store_sh(void *__P, __mmask8 __U, __m128h __A) {
1414
// LLVM: call void @llvm.masked.store.v8f16.p0(<8 x half> %{{.*}}, ptr %{{.*}}, i32 1, <8 x i1> %{{.*}})
1515
_mm_mask_store_sh(__P, __U, __A);
1616
}
17+
18+
__m128h test_mm_mask_load_sh(__m128h __A, __mmask8 __U, const void *__W) {
19+
// CIR-LABEL: _mm_mask_load_sh
20+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.f16 x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.f16 x 8>) -> !cir.vector<!cir.f16 x 8>
21+
22+
// LLVM-LABEL: @test_mm_mask_load_sh
23+
// LLVM: %{{.*}} = call <8 x half> @llvm.masked.load.v8f16.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x half> %{{.*}})
24+
return _mm_mask_load_sh(__A, __U, __W);
25+
}
26+
27+
__m128h test_mm_maskz_load_sh(__mmask8 __U, const void *__W) {
28+
// CIR-LABEL: _mm_maskz_load_sh
29+
// CIR: %{{.*}} = cir.llvm.intrinsic "masked.load" %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : (!cir.ptr<!cir.vector<!cir.f16 x 8>>, !u32i, !cir.vector<!cir.int<s, 1> x 8>, !cir.vector<!cir.f16 x 8>) -> !cir.vector<!cir.f16 x 8>
30+
31+
// LLVM-LABEL: @test_mm_maskz_load_sh
32+
// LLVM: %{{.*}} = call <8 x half> @llvm.masked.load.v8f16.p0(ptr %{{.*}}, i32 1, <8 x i1> %{{.*}}, <8 x half> %{{.*}})
33+
return _mm_maskz_load_sh(__U, __W);
34+
}

0 commit comments

Comments
 (0)