Skip to content

Commit 4ceae74

Browse files
committed
Implement extractf, tests are from clang/test/CodeGen/X86/avx512f-builtins.c
1 parent 0006cd6 commit 4ceae74

File tree

4 files changed

+283
-6
lines changed

4 files changed

+283
-6
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,8 +1870,8 @@ def CIR_SelectOp : CIR_Op<"select", [
18701870
let summary = "Yield one of two values based on a boolean value";
18711871
let description = [{
18721872
The `cir.select` operation takes three operands. The first operand
1873-
`condition` is a boolean value of type `!cir.bool`. The second and the third
1874-
operand can be of any CIR types, but their types must be the same. If the
1873+
`condition` is either a boolean value of type `!cir.bool` or a boolean vector of type `!cir.bool`.
1874+
The second and the third operand can be of any CIR types, but their types must be the same. If the
18751875
first operand is `true`, the operation yields its second operand. Otherwise,
18761876
the operation yields its third operand.
18771877

@@ -1885,7 +1885,7 @@ def CIR_SelectOp : CIR_Op<"select", [
18851885
```
18861886
}];
18871887

1888-
let arguments = (ins CIR_BoolType:$condition, CIR_AnyType:$true_value,
1888+
let arguments = (ins CIR_ScalarOrVectorOf<CIR_BoolType>:$condition, CIR_AnyType:$true_value,
18891889
CIR_AnyType:$false_value);
18901890
let results = (outs CIR_AnyType:$result);
18911891

clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ def CIR_PtrToArray : CIR_PtrToType<CIR_AnyArrayType>;
250250

251251
def CIR_AnyVectorType : CIR_TypeBase<"::cir::VectorType", "vector type">;
252252

253-
def CIR_VectorElementType : AnyTypeOf<[CIR_AnyIntOrFloatType, CIR_AnyPtrType],
254-
"any cir integer, floating point or pointer type"
253+
def CIR_VectorElementType : AnyTypeOf<[CIR_AnyBoolType, CIR_AnyIntOrFloatType, CIR_AnyPtrType],
254+
"any cir boolean, integer, floating point or pointer type"
255255
> {
256256
let cppFunctionName = "isValidVectorTypeElementType";
257257
}
@@ -266,6 +266,16 @@ class CIR_VectorTypeOf<list<Type> types, string summary = "">
266266
"vector of " # CIR_TypeSummaries<types>.value,
267267
summary)>;
268268

269+
class CIR_VectorOf<Type T> : CIR_ConfinedType<
270+
CIR_AnyVectorType,
271+
[CIR_ElementTypePred<T.predicate>],
272+
"CIR vector of " # T.summary>;
273+
274+
// Type constraint accepting a either a type T or a vector of type T
275+
// Mimicking LLVMIR's LLVM_ScalarOrVectorOf
276+
class CIR_ScalarOrVectorOf<Type T> :
277+
AnyTypeOf<[T, CIR_VectorOf<T>]>;
278+
269279
// Vector of integral type
270280
def IntegerVector : Type<
271281
And<[

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,71 @@ computeFullLaneShuffleMask(CIRGenFunction &cgf, const mlir::Value vec,
152152
outIndices.resize(numElts);
153153
}
154154

155+
static mlir::Value getBoolMaskVecValue(CIRGenBuilderTy &builder,
156+
mlir::Location loc, mlir::Value mask,
157+
unsigned numElems) {
158+
159+
cir::BoolType boolTy = builder.getBoolTy();
160+
auto maskTy = cir::VectorType::get(
161+
boolTy, cast<cir::IntType>(mask.getType()).getWidth());
162+
mlir::Value maskVec = builder.createBitcast(mask, maskTy);
163+
164+
if (numElems < 8) {
165+
SmallVector<mlir::Attribute, 4> indices;
166+
mlir::Type i32Ty = builder.getSInt32Ty();
167+
for (auto i : llvm::seq<unsigned>(0, numElems))
168+
indices.push_back(cir::IntAttr::get(i32Ty, i));
169+
170+
maskVec = builder.createVecShuffle(loc, maskVec, maskVec, indices);
171+
}
172+
return maskVec;
173+
}
174+
175+
// Helper function mirroring OG's bool Constant::isAllOnesValue()
176+
static bool isAllOnesValue(mlir::Value value) {
177+
auto constOp = mlir::dyn_cast_or_null<cir::ConstantOp>(value.getDefiningOp());
178+
if (!constOp)
179+
return false;
180+
181+
// Check for -1 integers
182+
if (auto intAttr = constOp.getValueAttr<cir::IntAttr>()) {
183+
return intAttr.getValue().isAllOnes();
184+
}
185+
186+
// Check for FP which are bitcasted from -1 integers
187+
if (auto fpAttr = constOp.getValueAttr<cir::FPAttr>()) {
188+
return fpAttr.getValue().bitcastToAPInt().isAllOnes();
189+
}
190+
191+
// Check for constant vectors with splat values
192+
if (cir::VectorType v = dyn_cast<cir::VectorType>(constOp.getType())) {
193+
if (auto vecAttr = constOp.getValueAttr<mlir::DenseElementsAttr>()) {
194+
if (vecAttr.isSplat()) {
195+
auto splatAttr = vecAttr.getSplatValue<mlir::Attribute>();
196+
if (auto splatInt = mlir::dyn_cast<cir::IntAttr>(splatAttr)) {
197+
return splatInt.getValue().isAllOnes();
198+
}
199+
}
200+
}
201+
}
202+
203+
return false;
204+
}
205+
206+
static mlir::Value emitX86Select(CIRGenBuilderTy &builder, mlir::Location loc,
207+
mlir::Value mask, mlir::Value op0,
208+
mlir::Value op1) {
209+
210+
// If the mask is all ones just return first argument.
211+
if (isAllOnesValue(mask))
212+
return op0;
213+
214+
mask = getBoolMaskVecValue(builder, loc, mask,
215+
cast<cir::VectorType>(op0.getType()).getSize());
216+
217+
return builder.createSelect(loc, mask, op0, op1);
218+
}
219+
155220
static mlir::Value emitX86MaskAddLogic(CIRGenBuilderTy &builder,
156221
mlir::Location loc,
157222
const std::string &intrinsicName,
@@ -887,7 +952,31 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
887952
case X86::BI__builtin_ia32_extractf64x2_256_mask:
888953
case X86::BI__builtin_ia32_extracti64x2_256_mask:
889954
case X86::BI__builtin_ia32_extractf64x2_512_mask:
890-
case X86::BI__builtin_ia32_extracti64x2_512_mask:
955+
case X86::BI__builtin_ia32_extracti64x2_512_mask: {
956+
mlir::Location loc = getLoc(expr->getExprLoc());
957+
cir::VectorType dstTy = cast<cir::VectorType>(convertType(expr->getType()));
958+
unsigned numElts = dstTy.getSize();
959+
unsigned srcNumElts = cast<cir::VectorType>(ops[0].getType()).getSize();
960+
unsigned subVectors = srcNumElts / numElts;
961+
unsigned index =
962+
ops[1].getDefiningOp<cir::ConstantOp>().getIntValue().getZExtValue();
963+
964+
index &= subVectors - 1; // Remove any extra bits.
965+
index *= numElts;
966+
967+
int64_t indices[16];
968+
for (unsigned i = 0; i != numElts; ++i)
969+
indices[i] = i + index;
970+
971+
mlir::Value zero = builder.getNullValue(ops[0].getType(), loc);
972+
mlir::Value res =
973+
builder.createVecShuffle(loc, ops[0], zero, ArrayRef(indices, numElts));
974+
if (ops.size() == 4) {
975+
res = emitX86Select(builder, loc, ops[3], res, ops[2]);
976+
}
977+
978+
return res;
979+
}
891980
case X86::BI__builtin_ia32_vinsertf128_pd256:
892981
case X86::BI__builtin_ia32_vinsertf128_ps256:
893982
case X86::BI__builtin_ia32_vinsertf128_si256:

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

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,3 +695,181 @@ void test_mm512_mask_i64scatter_epi32(void *__addr, __mmask8 __mask, __m512i __i
695695
// OGCG: @llvm.x86.avx512.mask.scatter.qpi.512
696696
return _mm512_mask_i64scatter_epi32(__addr, __mask, __index, __v1, 2);
697697
}
698+
699+
__m256d test_mm512_extractf64x4_pd(__m512d a)
700+
{
701+
// CIR-LABEL: test_mm512_extractf64x4_pd
702+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
703+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
704+
705+
// LLVM-LABEL: test_mm512_extractf64x4_pd
706+
// LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
707+
708+
// OGCG-LABEL: test_mm512_extractf64x4_pd
709+
// OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
710+
return _mm512_extractf64x4_pd(a, 1);
711+
}
712+
713+
__m256d test_mm512_mask_extractf64x4_pd(__m256d __W,__mmask8 __U,__m512d __A){
714+
// CIR-LABEL: test_mm512_mask_extractf64x4_pd
715+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
716+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
717+
// CIR: cir.select if %{{.*}} then %{{.*}} else %{{.*}} : (!cir.vector<4 x !cir.bool>, !cir.vector<4 x !cir.double>, !cir.vector<4 x !cir.double>) -> !cir.vector<4 x !cir.double>
718+
719+
// LLVM-LABEL: test_mm512_mask_extractf64x4_pd
720+
// LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
721+
// LLVM: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
722+
723+
// OGCG-LABEL: test_mm512_mask_extractf64x4_pd
724+
// OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
725+
// OGCG: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
726+
return _mm512_mask_extractf64x4_pd( __W, __U, __A, 1);
727+
}
728+
729+
__m256d test_mm512_maskz_extractf64x4_pd(__mmask8 __U,__m512d __A){
730+
// CIR-LABEL: test_mm512_maskz_extractf64x4_pd
731+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !cir.double>
732+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !cir.double>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.double>
733+
// CIR: cir.select if %{{.*}} then %{{.*}} else %{{.*}} : (!cir.vector<4 x !cir.bool>, !cir.vector<4 x !cir.double>, !cir.vector<4 x !cir.double>) -> !cir.vector<4 x !cir.double>
734+
735+
// LLVM-LABEL: test_mm512_maskz_extractf64x4_pd
736+
// LLVM: shufflevector <8 x double> %{{.*}}, <8 x double> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
737+
// LLVM: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
738+
739+
// OGCG-LABEL: test_mm512_maskz_extractf64x4_pd
740+
// OGCG: shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
741+
// OGCG: select <4 x i1> %{{.*}}, <4 x double> %{{.*}}, <4 x double> %{{.*}}
742+
return _mm512_maskz_extractf64x4_pd( __U, __A, 1);
743+
}
744+
745+
__m128 test_mm512_extractf32x4_ps(__m512 a)
746+
{
747+
// CIR-LABEL: test_mm512_extractf32x4_ps
748+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !cir.float>
749+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
750+
751+
// LLVM-LABEL: test_mm512_extractf32x4_ps
752+
// LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
753+
754+
// OGCG-LABEL: test_mm512_extractf32x4_ps
755+
// OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
756+
return _mm512_extractf32x4_ps(a, 1);
757+
}
758+
759+
__m128 test_mm512_mask_extractf32x4_ps(__m128 __W, __mmask8 __U,__m512 __A){
760+
// CIR-LABEL: test_mm512_mask_extractf32x4_ps
761+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !cir.float>
762+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
763+
764+
// LLVM-LABEL: test_mm512_mask_extractf32x4_ps
765+
// LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
766+
// LLVM: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
767+
768+
// OGCG-LABEL: test_mm512_mask_extractf32x4_ps
769+
// OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
770+
// OGCG: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
771+
return _mm512_mask_extractf32x4_ps( __W, __U, __A, 1);
772+
}
773+
774+
__m128 test_mm512_maskz_extractf32x4_ps( __mmask8 __U,__m512 __A){
775+
// CIR-LABEL: test_mm512_maskz_extractf32x4_ps
776+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !cir.float>
777+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !cir.float>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !cir.float>
778+
779+
// LLVM-LABEL: test_mm512_maskz_extractf32x4_ps
780+
// LLVM: shufflevector <16 x float> %{{.*}}, <16 x float> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
781+
// LLVM: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
782+
783+
// OGCG-LABEL: test_mm512_maskz_extractf32x4_ps
784+
// OGCG: shufflevector <16 x float> %{{.*}}, <16 x float> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
785+
// OGCG: select <4 x i1> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}
786+
return _mm512_maskz_extractf32x4_ps(__U, __A, 1);
787+
}
788+
789+
__m128i test_mm512_extracti32x4_epi32(__m512i __A) {
790+
// CIR-LABEL: test_mm512_extracti32x4_epi32
791+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !s32i>
792+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
793+
794+
// LLVM-LABEL: test_mm512_extracti32x4_epi32
795+
// LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> zeroinitializer, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
796+
797+
// OGCG-LABEL: test_mm512_extracti32x4_epi32
798+
// OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
799+
return _mm512_extracti32x4_epi32(__A, 3);
800+
}
801+
802+
__m128i test_mm512_mask_extracti32x4_epi32(__m128i __W, __mmask8 __U, __m512i __A) {
803+
// CIR-LABEL: test_mm512_mask_extracti32x4_epi32
804+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !s32i>
805+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
806+
// CIR: cir.select if %{{.*}} then %{{.*}} else %{{.*}} : (!cir.vector<4 x !cir.bool>, !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>) -> !cir.vector<4 x !s32i>
807+
808+
// LLVM-LABEL: test_mm512_mask_extracti32x4_epi32
809+
// LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> zeroinitializer, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
810+
// LLVM: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
811+
812+
// OGCG-LABEL: test_mm512_mask_extracti32x4_epi32
813+
// OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
814+
// OGCG: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
815+
return _mm512_mask_extracti32x4_epi32(__W, __U, __A, 3);
816+
}
817+
818+
__m128i test_mm512_maskz_extracti32x4_epi32(__mmask8 __U, __m512i __A) {
819+
// CIR-LABEL: test_mm512_maskz_extracti32x4_epi32
820+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<16 x !s32i>
821+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<16 x !s32i>) [#cir.int<12> : !s32i, #cir.int<13> : !s32i, #cir.int<14> : !s32i, #cir.int<15> : !s32i] : !cir.vector<4 x !s32i>
822+
// CIR: cir.select if %{{.*}} then %{{.*}} else %{{.*}} : (!cir.vector<4 x !cir.bool>, !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>) -> !cir.vector<4 x !s32i>
823+
824+
// LLVM-LABEL: test_mm512_maskz_extracti32x4_epi32
825+
// LLVM: shufflevector <16 x i32> %{{.*}}, <16 x i32> zeroinitializer, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
826+
// LLVM: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
827+
828+
// OGCG-LABEL: test_mm512_maskz_extracti32x4_epi32
829+
// OGCG: shufflevector <16 x i32> %{{.*}}, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
830+
// OGCG: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
831+
return _mm512_maskz_extracti32x4_epi32(__U, __A, 3);
832+
}
833+
834+
__m256i test_mm512_extracti64x4_epi64(__m512i __A) {
835+
// CIR-LABEL: test_mm512_extracti64x4_epi64
836+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !s64i>
837+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
838+
839+
// LLVM-LABEL: test_mm512_extracti64x4_epi64
840+
// LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
841+
842+
// OGCG-LABEL: test_mm512_extracti64x4_epi64
843+
// OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
844+
return _mm512_extracti64x4_epi64(__A, 1);
845+
}
846+
847+
__m256i test_mm512_mask_extracti64x4_epi64(__m256i __W, __mmask8 __U, __m512i __A) {
848+
// CIR-LABEL: test_mm512_mask_extracti64x4_epi64
849+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !s64i>
850+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
851+
852+
// LLVM-LABEL: test_mm512_mask_extracti64x4_epi64
853+
// LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
854+
// LLVM: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
855+
856+
// OGCG-LABEL: test_mm512_mask_extracti64x4_epi64
857+
// OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
858+
// OGCG: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
859+
return _mm512_mask_extracti64x4_epi64(__W, __U, __A, 1);
860+
}
861+
862+
__m256i test_mm512_maskz_extracti64x4_epi64(__mmask8 __U, __m512i __A) {
863+
// CIR-LABEL: test_mm512_maskz_extracti64x4_epi64
864+
// CIR: [[ZERO:%.*]] = cir.const #cir.zero : !cir.vector<8 x !s64i>
865+
// CIR: cir.vec.shuffle(%{{.*}}, [[ZERO]] : !cir.vector<8 x !s64i>) [#cir.int<4> : !s32i, #cir.int<5> : !s32i, #cir.int<6> : !s32i, #cir.int<7> : !s32i] : !cir.vector<4 x !s64i>
866+
867+
// LLVM-LABEL: test_mm512_maskz_extracti64x4_epi64
868+
// LLVM: shufflevector <8 x i64> %{{.*}}, <8 x i64> zeroinitializer, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
869+
// LLVM: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
870+
871+
// OGCG-LABEL: test_mm512_maskz_extracti64x4_epi64
872+
// OGCG: shufflevector <8 x i64> %{{.*}}, <8 x i64> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
873+
// OGCG: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}}
874+
return _mm512_maskz_extracti64x4_epi64(__U, __A, 1);
875+
}

0 commit comments

Comments
 (0)