case X86ISD::TESTM: return "X86ISD::TESTM";
case X86ISD::TESTNM: return "X86ISD::TESTNM";
case X86ISD::KORTEST: return "X86ISD::KORTEST";
+ case X86ISD::KTEST: return "X86ISD::KTEST";
case X86ISD::PACKSS: return "X86ISD::PACKSS";
case X86ISD::PACKUS: return "X86ISD::PACKUS";
case X86ISD::PALIGNR: return "X86ISD::PALIGNR";
// OR/AND test for masks
KORTEST,
+ KTEST,
// Several flavors of instructions with vector shuffle behaviors.
PACKSS,
// Mask bit testing
multiclass avx512_mask_testop<bits<8> opc, string OpcodeStr, RegisterClass KRC,
- SDNode OpNode> {
- let Predicates = [HasAVX512], Defs = [EFLAGS] in
+ SDNode OpNode, Predicate prd> {
+ let Predicates = [prd], Defs = [EFLAGS] in
def rr : I<opc, MRMSrcReg, (outs), (ins KRC:$src1, KRC:$src2),
!strconcat(OpcodeStr, "\t{$src2, $src1|$src1, $src2}"),
[(set EFLAGS, (OpNode KRC:$src1, KRC:$src2))]>;
}
-multiclass avx512_mask_testop_w<bits<8> opc, string OpcodeStr, SDNode OpNode> {
- defm W : avx512_mask_testop<opc, !strconcat(OpcodeStr, "w"), VK16, OpNode>,
- VEX, PS;
- let Predicates = [HasDQI] in
- defm B : avx512_mask_testop<opc, !strconcat(OpcodeStr, "b"), VK8, OpNode>,
- VEX, PD;
- let Predicates = [HasBWI] in {
- defm Q : avx512_mask_testop<opc, !strconcat(OpcodeStr, "q"), VK64, OpNode>,
- VEX, PS, VEX_W;
- defm D : avx512_mask_testop<opc, !strconcat(OpcodeStr, "d"), VK32, OpNode>,
- VEX, PD, VEX_W;
- }
+multiclass avx512_mask_testop_w<bits<8> opc, string OpcodeStr, SDNode OpNode,
+ Predicate prdW = HasAVX512> {
+ defm B : avx512_mask_testop<opc, OpcodeStr#"b", VK8, OpNode, HasDQI>,
+ VEX, PD;
+ defm W : avx512_mask_testop<opc, OpcodeStr#"w", VK16, OpNode, prdW>,
+ VEX, PS;
+ defm Q : avx512_mask_testop<opc, OpcodeStr#"q", VK64, OpNode, HasBWI>,
+ VEX, PS, VEX_W;
+ defm D : avx512_mask_testop<opc, OpcodeStr#"d", VK32, OpNode, HasBWI>,
+ VEX, PD, VEX_W;
}
defm KORTEST : avx512_mask_testop_w<0x98, "kortest", X86kortest>;
+defm KTEST : avx512_mask_testop_w<0x99, "ktest", X86ktest, HasDQI>;
// Mask shift
multiclass avx512_mask_shiftop<bits<8> opc, string OpcodeStr, RegisterClass KRC,
def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
def X86testp : SDNode<"X86ISD::TESTP", SDTX86CmpPTest>;
def X86kortest : SDNode<"X86ISD::KORTEST", SDTX86CmpPTest>;
+def X86ktest : SDNode<"X86ISD::KTEST", SDTX86CmpPTest>;
def X86testm : SDNode<"X86ISD::TESTM", SDTypeProfile<1, 2, [SDTCisVec<0>,
SDTCisVec<1>, SDTCisSameAs<2, 1>,
SDTCVecEltisVT<0, i1>,
// CHECK: encoding: [0x62,0xf2,0xc5,0x08,0x43,0x92,0xf8,0xfb,0xff,0xff]
vgetexpsd -1032(%rdx), %xmm7, %xmm2
+// CHECK: kortestw %k6, %k2
+// CHECK: encoding: [0xc5,0xf8,0x98,0xd6]
+ kortestw %k6, %k2
+
// CHECK: vscatterqps %ymm6, 123(%r14,%zmm27,8) {%k1}
// CHECK: encoding: [0x62,0x92,0x7d,0x41,0xa3,0xb4,0xde,0x7b,0x00,0x00,0x00]
vscatterqps %ymm6, 123(%r14,%zmm27,8) {%k1}
// CHECK: encoding: [0x62,0x61,0x2d,0x40,0x69,0xb2,0xc0,0xdf,0xff,0xff]
vpunpckhwd -8256(%rdx), %zmm26, %zmm30
+// CHECK: ktestd %k3, %k3
+// CHECK: encoding: [0xc4,0xe1,0xf9,0x99,0xdb]
+ ktestd %k3, %k3
+
+// CHECK: ktestq %k6, %k2
+// CHECK: encoding: [0xc4,0xe1,0xf8,0x99,0xd6]
+ ktestq %k6, %k2
+
+// CHECK: kortestd %k3, %k4
+// CHECK: encoding: [0xc4,0xe1,0xf9,0x98,0xe3]
+ kortestd %k3, %k4
+
+// CHECK: kortestq %k4, %k5
+// CHECK: encoding: [0xc4,0xe1,0xf8,0x98,0xec]
+ kortestq %k4, %k5
+
// CHECK: kaddd %k6, %k6, %k2
// CHECK: encoding: [0xc4,0xe1,0xcd,0x4a,0xd6]
kaddd %k6, %k6, %k2
// CHECK: encoding: [0x62,0xa1,0xff,0xca,0x7a,0xd5]
vcvtuqq2ps %zmm21, %ymm18 {%k2} {z}
+// CHECK: ktestb %k6, %k4
+// CHECK: encoding: [0xc5,0xf9,0x99,0xe6]
+ ktestb %k6, %k4
+
+// CHECK: ktestb %k4, %k5
+// CHECK: encoding: [0xc5,0xf9,0x99,0xec]
+ ktestb %k4, %k5
+
+// CHECK: ktestw %k4, %k5
+// CHECK: encoding: [0xc5,0xf8,0x99,0xec]
+ ktestw %k4, %k5
+
+// CHECK: ktestw %k6, %k2
+// CHECK: encoding: [0xc5,0xf8,0x99,0xd6]
+ ktestw %k6, %k2
+
+// CHECK: kortestb %k3, %k2
+// CHECK: encoding: [0xc5,0xf9,0x98,0xd3]
+ kortestb %k3, %k2
+
+// CHECK: kortestb %k6, %k2
+// CHECK: encoding: [0xc5,0xf9,0x98,0xd6]
+ kortestb %k6, %k2
+
// CHECK: kaddb %k7, %k4, %k5
// CHECK: encoding: [0xc5,0xdd,0x4a,0xef]
kaddb %k7, %k4, %k5