llvm.org GIT mirror llvm / 1f0a0e3
AVX-512: Added implementation of CONCAT_VECTORS for v8i1 vectors (by Alexey Bader). Added implementation of "truncate" from integer type (i64/i32/i16/i8) to i1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197482 91177308-0d34-0410-b5e6-96231b3b80d8 Elena Demikhovsky 6 years ago
5 changed file(s) with 37 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
13551355 setOperationAction(ISD::FP_ROUND, MVT::v8f32, Legal);
13561356 setOperationAction(ISD::FP_EXTEND, MVT::v8f32, Legal);
13571357
1358 setOperationAction(ISD::TRUNCATE, MVT::i1, Legal);
1358 setOperationAction(ISD::TRUNCATE, MVT::i1, Custom);
13591359 setOperationAction(ISD::TRUNCATE, MVT::v16i8, Custom);
13601360 setOperationAction(ISD::TRUNCATE, MVT::v8i32, Custom);
13611361 setOperationAction(ISD::TRUNCATE, MVT::v8i1, Custom);
13731373 setOperationAction(ISD::CONCAT_VECTORS, MVT::v16f32, Custom);
13741374 setOperationAction(ISD::CONCAT_VECTORS, MVT::v16i32, Custom);
13751375 setOperationAction(ISD::CONCAT_VECTORS, MVT::v8i1, Custom);
1376 setOperationAction(ISD::CONCAT_VECTORS, MVT::v16i1, Legal);
13761377
13771378 setOperationAction(ISD::SETCC, MVT::v16i1, Custom);
13781379 setOperationAction(ISD::SETCC, MVT::v8i1, Custom);
90659066 MVT VT = Op.getSimpleValueType();
90669067 SDValue In = Op.getOperand(0);
90679068 MVT InVT = In.getSimpleValueType();
9069
9070 if (VT == MVT::i1) {
9071 assert((InVT.isInteger() && (InVT.getSizeInBits() <= 64)) &&
9072 "Invalid scalar TRUNCATE operation");
9073 In = DAG.getNode(ISD::AND, DL, InVT, In, DAG.getConstant(1, InVT));
9074 if (InVT.getSizeInBits() == 64)
9075 In = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, MVT::i32, In);
9076 else if (InVT.getSizeInBits() < 32)
9077 In = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i32, In);
9078 return DAG.getNode(X86ISD::TRUNC, DL, VT, In);
9079 }
90689080 assert(VT.getVectorNumElements() == InVT.getVectorNumElements() &&
90699081 "Invalid TRUNCATE operation");
90709082
258258
259259 // VTRUNC - Vector integer truncate.
260260 VTRUNC,
261
262 // TRUNC - Integer truncate
263 TRUNC,
261264
262265 // VTRUNC - Vector integer truncate with mask.
263266 VTRUNCM,
907907
908908 def : Pat<(v8i1 (load addr:$src)),
909909 (COPY_TO_REGCLASS (KMOVWkm addr:$src), VK8)>;
910
911 def : Pat<(i1 (X86trunc (i32 GR32:$src))),
912 (COPY_TO_REGCLASS (KMOVWkr $src), VK1)>;
910913 }
911914 // With AVX-512 only, 8-bit mask is promoted to 16-bit mask.
912915 let Predicates = [HasAVX512] in {
10501053 }
10511054
10521055 defm KUNPCK : avx512_mask_unpck_bw<0x4b, "kunpck">;
1056 def : Pat<(v16i1 (concat_vectors (v8i1 VK8:$src1), (v8i1 VK8:$src2))),
1057 (KUNPCKBWrr (COPY_TO_REGCLASS VK8:$src2, VK16),
1058 (COPY_TO_REGCLASS VK8:$src1, VK16))>;
1059
10531060
10541061 multiclass avx512_mask_unpck_int {
10551062 let Predicates = [HasAVX512] in
107107 def X86vtrunc : SDNode<"X86ISD::VTRUNC",
108108 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
109109 SDTCisInt<0>, SDTCisInt<1>]>>;
110 def X86trunc : SDNode<"X86ISD::TRUNC",
111 SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]>>;
112
110113 def X86vtruncm : SDNode<"X86ISD::VTRUNCM",
111114 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
112115 SDTCisInt<0>, SDTCisInt<1>,
110110 %max = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> %y
111111 ret <8 x i32> %max
112112 }
113
114 ; CHECK-LABEL: test12
115 ; CHECK: vpcmpeqq %zmm2, %zmm0, [[LO:%k[0-7]]]
116 ; CHECK: vpcmpeqq %zmm3, %zmm1, [[HI:%k[0-7]]]
117 ; CHECK: kunpckbw [[LO]], [[HI]], {{%k[0-7]}}
118
119 define i16 @test12(<16 x i64> %a, <16 x i64> %b) nounwind {
120 %res = icmp eq <16 x i64> %a, %b
121 %res1 = bitcast <16 x i1> %res to i16
122 ret i16 %res1
123 }