As predicate masks are legal on AVX512 targets, we avoid MOVMSK in these cases, but we can just bitcast the bool vector to the integer equivalent directly - avoiding expansion of the reduction to a shuffle pattern.
llvm-svn: 359386
static SDValue combineHorizontalPredicateResult(SDNode *Extract,
SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
- // Bail without SSE2 or with AVX512VL (which uses predicate registers).
- if (!Subtarget.hasSSE2() || Subtarget.hasVLX())
+ // Bail without SSE2.
+ if (!Subtarget.hasSSE2())
return SDValue();
EVT ExtractVT = Extract->getValueType(0);
SDValue Movmsk;
SDLoc DL(Extract);
- unsigned NumElts = Match.getValueType().getVectorNumElements();
+ EVT MatchVT = Match.getValueType();
+ unsigned NumElts = MatchVT.getVectorNumElements();
if (ExtractVT == MVT::i1) {
// Special case for (pre-legalization) vXi1 reductions.
- // Use combineBitcastvxi1 to create the MOVMSK.
if (NumElts > 32)
return SDValue();
- if (NumElts == 32 && !Subtarget.hasInt256()) {
- SDValue Lo, Hi;
- std::tie(Lo, Hi) = DAG.SplitVector(Match, DL);
- Match = DAG.getNode(BinOp, DL, Lo.getValueType(), Lo, Hi);
- NumElts = 16;
+ if (DAG.getTargetLoweringInfo().isTypeLegal(MatchVT)) {
+ // If this is a legal AVX512 predicate type then we can just bitcast.
+ EVT MovmskVT = EVT::getIntegerVT(*DAG.getContext(), NumElts);
+ Movmsk = DAG.getBitcast(MovmskVT, Match);
+ } else {
+ // Use combineBitcastvxi1 to create the MOVMSK.
+ if (NumElts == 32 && !Subtarget.hasInt256()) {
+ SDValue Lo, Hi;
+ std::tie(Lo, Hi) = DAG.SplitVector(Match, DL);
+ Match = DAG.getNode(BinOp, DL, Lo.getValueType(), Lo, Hi);
+ NumElts = 16;
+ }
+ EVT MovmskVT = EVT::getIntegerVT(*DAG.getContext(), NumElts);
+ Movmsk = combineBitcastvxi1(DAG, MovmskVT, Match, DL, Subtarget);
}
- EVT MovmskVT = EVT::getIntegerVT(*DAG.getContext(), NumElts);
- Movmsk = combineBitcastvxi1(DAG, MovmskVT, Match, DL, Subtarget);
if (!Movmsk)
return SDValue();
Movmsk = DAG.getZExtOrTrunc(Movmsk, DL, MVT::i32);
} else {
+ // Bail with AVX512VL (which uses predicate registers).
+ if (Subtarget.hasVLX())
+ return SDValue();
+
unsigned MatchSizeInBits = Match.getValueSizeInBits();
if (!(MatchSizeInBits == 128 ||
(MatchSizeInBits == 256 && Subtarget.hasAVX())))
;
; AVX512-LABEL: bool_reduction_v2f64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpltpd %xmm0, %xmm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512-NEXT: vptestmq %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vcmpltpd %xmm0, %xmm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $3, %al
+; AVX512-NEXT: cmpb $3, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: retq
%a = fcmp ogt <2 x double> %x, %y
%b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4f32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpeqps %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vcmpeqps %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $15, %al
+; AVX512-NEXT: cmpb $15, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: retq
%a = fcmp oeq <4 x float> %x, %y
%s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4f64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmplepd %ymm0, %ymm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vcmplepd %ymm0, %ymm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $15, %al
+; AVX512-NEXT: cmpb $15, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = fcmp oge <4 x double> %x, %y
;
; AVX512-LABEL: bool_reduction_v8f32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpneqps %ymm1, %ymm0, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512-NEXT: vcmpneqps %ymm1, %ymm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: cmpb $-1, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = fcmp une <8 x float> %x, %y
;
; AVX512-LABEL: bool_reduction_v2i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpnleuq %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512-NEXT: vptestmq %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $3, %al
+; AVX512-NEXT: cmpb $3, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: retq
%a = icmp ugt <2 x i64> %x, %y
%b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpneqd %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vpcmpneqd %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $15, %al
+; AVX512-NEXT: cmpb $15, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: retq
%a = icmp ne <4 x i32> %x, %y
%s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v8i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpgtw %xmm0, %xmm1, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512-NEXT: vpcmpgtw %xmm0, %xmm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
-; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: cmpb $-1, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: retq
%a = icmp slt <8 x i16> %x, %y
%s1 = shufflevector <8 x i1> %a, <8 x i1> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
; AVX512-LABEL: bool_reduction_v16i8:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: retq
%a = icmp sgt <16 x i8> %x, %y
%s1 = shufflevector <16 x i1> %a, <16 x i1> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpgtq %ymm0, %ymm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512-NEXT: vpcmpgtq %ymm0, %ymm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: andb $15, %al
+; AVX512-NEXT: cmpb $15, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp slt <4 x i64> %x, %y
;
; AVX512-LABEL: bool_reduction_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpleud %ymm1, %ymm0, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512-NEXT: vpcmpleud %ymm1, %ymm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: cmpb $-1, %al
+; AVX512-NEXT: sete %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp ule <8 x i32> %x, %y
; AVX512-LABEL: bool_reduction_v16i16:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpeqw %ymm1, %ymm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: kandw %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <16 x i16> %x, %y
; AVX512-LABEL: bool_reduction_v32i8:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpeqb %ymm1, %ymm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kandd %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kandd %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kandd %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kandd %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kandd %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <32 x i8> %x, %y
;
; AVX512-LABEL: bool_reduction_v2f64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpltpd %xmm0, %xmm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512-NEXT: vptestmq %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k0, %k1, %k0
+; AVX512-NEXT: vcmpltpd %xmm0, %xmm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $3, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = fcmp ogt <2 x double> %x, %y
%b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4f32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpeqps %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vcmpeqps %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $15, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = fcmp oeq <4 x float> %x, %y
%s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4f64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmplepd %ymm0, %ymm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vcmplepd %ymm0, %ymm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $15, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = fcmp oge <4 x double> %x, %y
;
; AVX512-LABEL: bool_reduction_v8f32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vcmpneqps %ymm1, %ymm0, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vcmpneqps %ymm1, %ymm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb %al, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = fcmp une <8 x float> %x, %y
;
; AVX512-LABEL: bool_reduction_v2i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpnleuq %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512-NEXT: vptestmq %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k0, %k1, %k0
+; AVX512-NEXT: vpcmpnleuq %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $3, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = icmp ugt <2 x i64> %x, %y
%b = shufflevector <2 x i1> %a, <2 x i1> undef, <2 x i32> <i32 1, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpneqd %xmm1, %xmm0, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vpcmpneqd %xmm1, %xmm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $15, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = icmp ne <4 x i32> %x, %y
%s1 = shufflevector <4 x i1> %a, <4 x i1> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v8i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpgtw %xmm0, %xmm1, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vpcmpgtw %xmm0, %xmm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
-; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: testb %al, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = icmp slt <8 x i16> %x, %y
%s1 = shufflevector <8 x i1> %a, <8 x i1> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
; AVX512-LABEL: bool_reduction_v16i8:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpgtb %xmm1, %xmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: retq
%a = icmp sgt <16 x i8> %x, %y
%s1 = shufflevector <16 x i1> %a, <16 x i1> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
;
; AVX512-LABEL: bool_reduction_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpgtq %ymm0, %ymm1, %k1
-; AVX512-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vpcmpgtq %ymm0, %ymm1, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb $15, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp slt <4 x i64> %x, %y
;
; AVX512-LABEL: bool_reduction_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpcmpleud %ymm1, %ymm0, %k1
-; AVX512-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512-NEXT: korw %k1, %k0, %k1
-; AVX512-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512-NEXT: korw %k1, %k0, %k0
+; AVX512-NEXT: vpcmpleud %ymm1, %ymm0, %k0
; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: testb %al, %al
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp ule <8 x i32> %x, %y
; AVX512-LABEL: bool_reduction_v16i16:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpeqw %ymm1, %ymm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: korw %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <16 x i16> %x, %y
; AVX512-LABEL: bool_reduction_v32i8:
; AVX512: # %bb.0:
; AVX512-NEXT: vpcmpeqb %ymm1, %ymm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kord %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kord %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kord %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kord %k0, %k1, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kord %k0, %k1, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <32 x i8> %x, %y
; AVX512BW-LABEL: trunc_v2i64_v2i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $3, %al
+; AVX512BW-NEXT: cmpb $3, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v2i64_v2i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $3, %al
+; AVX512VL-NEXT: cmpb $3, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = trunc <2 x i64> %0 to <2 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v2i1(<2 x i1> %a)
; AVX512BW-LABEL: trunc_v4i32_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $15, %al
+; AVX512BW-NEXT: cmpb $15, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v4i32_v4i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $15, %al
+; AVX512VL-NEXT: cmpb $15, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = trunc <4 x i32> %0 to <4 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v4i1(<4 x i1> %a)
; AVX512BW-LABEL: trunc_v8i16_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllw $15, %xmm0, %xmm0
-; AVX512BW-NEXT: vpmovw2m %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: cmpb $-1, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v8i16_v8i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllw $15, %xmm0, %xmm0
-; AVX512VL-NEXT: vpmovw2m %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512VL-NEXT: vpmovw2m %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
+; AVX512VL-NEXT: cmpb $-1, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = trunc <8 x i8> %0 to <8 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v8i1(<8 x i1> %a)
; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v16i8_v16i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllw $7, %xmm0, %xmm0
-; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: vpcmpgtb %zmm0, %zmm1, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v16i8_v16i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllw $7, %xmm0, %xmm0
-; AVX512VL-NEXT: vpmovb2m %xmm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v16i8_v16i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllw $7, %xmm0, %xmm0
+; AVX512-NEXT: vpmovmskb %xmm0, %eax
+; AVX512-NEXT: cmpw $-1, %ax
+; AVX512-NEXT: sete %al
+; AVX512-NEXT: retq
%a = trunc <16 x i8> %0 to <16 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v16i1(<16 x i1> %a)
ret i1 %b
; AVX512BW-LABEL: trunc_v4i64_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllq $63, %ymm0, %ymm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $15, %al
+; AVX512BW-NEXT: cmpb $15, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v4i64_v4i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllq $63, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmq %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestmq %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $15, %al
+; AVX512VL-NEXT: cmpb $15, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <4 x i64> %0 to <4 x i1>
; AVX512BW-LABEL: trunc_v8i32_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: cmpb $-1, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v8i32_v8i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: cmpb $-1, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <8 x i32> %0 to <8 x i1>
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllw $15, %ymm0, %ymm0
; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: vpcmpgtw %zmm0, %zmm1, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setb %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllw $15, %ymm0, %ymm0
; AVX512VL-NEXT: vpmovw2m %ymm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setb %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <16 x i16> %0 to <16 x i1>
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v32i8_v32i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllw $7, %ymm0, %ymm0
-; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrd $16, %k0, %k1
-; AVX512BW-NEXT: vpcmpgtb %zmm0, %zmm1, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrd $8, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $4, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $2, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $1, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v32i8_v32i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllw $7, %ymm0, %ymm0
-; AVX512VL-NEXT: vpmovb2m %ymm0, %k0
-; AVX512VL-NEXT: kshiftrd $16, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $8, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $4, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $2, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $1, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v32i8_v32i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllw $7, %ymm0, %ymm0
+; AVX512-NEXT: vpmovmskb %ymm0, %eax
+; AVX512-NEXT: cmpl $-1, %eax
+; AVX512-NEXT: sete %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = trunc <32 x i8> %0 to <32 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v32i1(<32 x i1> %a)
ret i1 %b
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v8i64_v8i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v8i64_v8i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512VL-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v8i64_v8i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllq $63, %zmm0, %zmm0
+; AVX512-NEXT: vptestmq %zmm0, %zmm0, %k0
+; AVX512-NEXT: kmovd %k0, %eax
+; AVX512-NEXT: cmpb $-1, %al
+; AVX512-NEXT: sete %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = trunc <8 x i64> %0 to <8 x i1>
%b = call i1 @llvm.experimental.vector.reduce.and.v8i1(<8 x i1> %a)
ret i1 %b
; AVX512: # %bb.0:
; AVX512-NEXT: vpslld $31, %zmm0, %zmm0
; AVX512-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = trunc <16 x i32> %0 to <16 x i1>
; AVX512: # %bb.0:
; AVX512-NEXT: vpsllw $15, %zmm0, %zmm0
; AVX512-NEXT: vpmovw2m %zmm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = trunc <32 x i16> %0 to <32 x i1>
; AVX512BW-LABEL: icmp_v2i64_v2i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $3, %al
+; AVX512BW-NEXT: cmpb $3, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v2i64_v2i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $3, %al
+; AVX512VL-NEXT: cmpb $3, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = icmp eq <2 x i64> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.and.v2i1(<2 x i1> %a)
; AVX512BW-LABEL: icmp_v4i32_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
-; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $15, %al
+; AVX512BW-NEXT: cmpb $15, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v4i32_v4i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $15, %al
+; AVX512VL-NEXT: cmpb $15, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = icmp eq <4 x i32> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.and.v4i1(<4 x i1> %a)
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
-; AVX512BW-NEXT: vptestnmw %zmm1, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestnmw %zmm1, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: cmpb $-1, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v8i16_v8i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmw {{.*}}(%rip), %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestnmw {{.*}}(%rip), %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
+; AVX512VL-NEXT: cmpb $-1, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: retq
%a = icmp eq <8 x i8> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.and.v8i1(<8 x i1> %a)
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setb %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v16i8_v16i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmb %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setb %al
; AVX512VL-NEXT: retq
%a = icmp eq <16 x i8> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.and.v16i1(<16 x i1> %a)
; AVX512BW-LABEL: icmp_v4i64_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: andb $15, %al
+; AVX512BW-NEXT: cmpb $15, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v4i64_v4i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: andb $15, %al
+; AVX512VL-NEXT: cmpb $15, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <4 x i64> %0, zeroinitializer
; AVX512BW-LABEL: icmp_v8i32_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
-; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
+; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: cmpb $-1, %al
+; AVX512BW-NEXT: sete %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v8i32_v8i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
+; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: cmpb $-1, %al
+; AVX512VL-NEXT: sete %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <8 x i32> %0, zeroinitializer
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: kandw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setb %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v16i16_v16i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmw %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: kandw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setb %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <16 x i16> %0, zeroinitializer
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; AVX512BW-NEXT: kshiftrd $16, %k0, %k1
-; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0 {%k1}
-; AVX512BW-NEXT: kshiftrd $8, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $4, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $2, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $1, %k0, %k1
-; AVX512BW-NEXT: kandd %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestd %k0, %k0
+; AVX512BW-NEXT: setb %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v32i8_v32i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmb %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: kshiftrd $16, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $8, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $4, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $2, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $1, %k0, %k1
-; AVX512VL-NEXT: kandd %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestd %k0, %k0
+; AVX512VL-NEXT: setb %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <32 x i8> %0, zeroinitializer
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: icmp_v8i64_v8i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1 {%k1}
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0 {%k1}
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: icmp_v8i64_v8i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k1 {%k1}
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0 {%k1}
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: icmp_v8i64_v8i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vptestnmq %zmm0, %zmm0, %k0
+; AVX512-NEXT: kmovd %k0, %eax
+; AVX512-NEXT: cmpb $-1, %al
+; AVX512-NEXT: sete %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = icmp eq <8 x i64> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.and.v8i1(<8 x i1> %a)
ret i1 %b
; AVX512-LABEL: icmp_v16i32_v16i1:
; AVX512: # %bb.0:
; AVX512-NEXT: vptestnmd %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: kandw %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <16 x i32> %0, zeroinitializer
; AVX512-LABEL: icmp_v32i16_v32i1:
; AVX512: # %bb.0:
; AVX512-NEXT: vptestnmw %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kandd %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setb %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <32 x i16> %0, zeroinitializer
; AVX512BW-LABEL: trunc_v2i64_v2i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $3, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v2i64_v2i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $3, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = trunc <2 x i64> %0 to <2 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v2i1(<2 x i1> %a)
; AVX512BW-LABEL: trunc_v4i32_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $15, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v4i32_v4i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX512VL-NEXT: vmovdqa32 %xmm1, %xmm2 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm2, %xmm2
-; AVX512VL-NEXT: vpor %xmm2, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vmovdqa32 %xmm1, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vpor %xmm1, %xmm0, %xmm0
; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $15, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = trunc <4 x i32> %0 to <4 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v4i1(<4 x i1> %a)
; AVX512BW-LABEL: trunc_v8i16_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllw $15, %xmm0, %xmm0
-; AVX512BW-NEXT: vpmovw2m %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb %al, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v8i16_v8i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllw $15, %xmm0, %xmm0
-; AVX512VL-NEXT: vpmovw2m %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vpmovw2m %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
+; AVX512VL-NEXT: testb %al, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = trunc <8 x i8> %0 to <8 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v8i1(<8 x i1> %a)
; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v16i8_v16i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllw $7, %xmm0, %xmm0
-; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v16i8_v16i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllw $7, %xmm0, %xmm0
-; AVX512VL-NEXT: vpmovb2m %xmm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v16i8_v16i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllw $7, %xmm0, %xmm0
+; AVX512-NEXT: vpmovmskb %xmm0, %eax
+; AVX512-NEXT: testw %ax, %ax
+; AVX512-NEXT: setne %al
+; AVX512-NEXT: retq
%a = trunc <16 x i8> %0 to <16 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v16i1(<16 x i1> %a)
ret i1 %b
; AVX512BW-LABEL: trunc_v4i64_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllq $63, %ymm0, %ymm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $15, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v4i64_v4i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllq $63, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmq %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestmq %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $15, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <4 x i64> %0 to <4 x i1>
; AVX512BW-LABEL: trunc_v8i32_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb %al, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: trunc_v8i32_v8i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
-; AVX512VL-NEXT: vmovdqa32 %ymm1, %ymm2 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm2, %xmm2
-; AVX512VL-NEXT: vpslld $31, %ymm2, %ymm2
-; AVX512VL-NEXT: vpor %ymm2, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm1, %ymm2 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm2, %ymm2
-; AVX512VL-NEXT: vpor %ymm2, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm1, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vpor %ymm1, %ymm0, %ymm0
; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb %al, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <8 x i32> %0 to <8 x i1>
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: vpsllw $15, %ymm0, %ymm0
; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vpsllw $15, %ymm0, %ymm0
; AVX512VL-NEXT: vpmovw2m %ymm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = trunc <16 x i16> %0 to <16 x i1>
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v32i8_v32i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllw $7, %ymm0, %ymm0
-; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
-; AVX512BW-NEXT: kshiftrd $16, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $8, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $4, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $2, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $1, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v32i8_v32i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllw $7, %ymm0, %ymm0
-; AVX512VL-NEXT: vpmovb2m %ymm0, %k0
-; AVX512VL-NEXT: kshiftrd $16, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $8, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $4, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $2, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $1, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v32i8_v32i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllw $7, %ymm0, %ymm0
+; AVX512-NEXT: vpmovmskb %ymm0, %eax
+; AVX512-NEXT: testl %eax, %eax
+; AVX512-NEXT: setne %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = trunc <32 x i8> %0 to <32 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v32i1(<32 x i1> %a)
ret i1 %b
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: trunc_v8i64_v8i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: trunc_v8i64_v8i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512VL-NEXT: vptestmq %zmm0, %zmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: trunc_v8i64_v8i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vpsllq $63, %zmm0, %zmm0
+; AVX512-NEXT: vptestmq %zmm0, %zmm0, %k0
+; AVX512-NEXT: kmovd %k0, %eax
+; AVX512-NEXT: testb %al, %al
+; AVX512-NEXT: setne %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = trunc <8 x i64> %0 to <8 x i1>
%b = call i1 @llvm.experimental.vector.reduce.or.v8i1(<8 x i1> %a)
ret i1 %b
; AVX512: # %bb.0:
; AVX512-NEXT: vpslld $31, %zmm0, %zmm0
; AVX512-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = trunc <16 x i32> %0 to <16 x i1>
; AVX512: # %bb.0:
; AVX512-NEXT: vpsllw $15, %zmm0, %zmm0
; AVX512-NEXT: vpmovw2m %zmm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = trunc <32 x i16> %0 to <32 x i1>
; AVX512BW-LABEL: icmp_v2i64_v2i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $3, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v2i64_v2i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $3, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = icmp eq <2 x i64> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.or.v2i1(<2 x i1> %a)
; AVX512BW-LABEL: icmp_v4i32_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
-; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $15, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v4i32_v4i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $15, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = icmp eq <4 x i32> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.or.v4i1(<4 x i1> %a)
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
-; AVX512BW-NEXT: vptestnmw %zmm1, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestnmw %zmm1, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb %al, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v8i16_v8i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmw {{.*}}(%rip), %xmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestnmw {{.*}}(%rip), %xmm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
+; AVX512VL-NEXT: testb %al, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = icmp eq <8 x i8> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.or.v8i1(<8 x i1> %a)
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v16i8_v16i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmb %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: retq
%a = icmp eq <16 x i8> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.or.v16i1(<16 x i1> %a)
; AVX512BW-LABEL: icmp_v4i64_v4i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb $15, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v4i64_v4i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %xmm1, %xmm1
-; AVX512VL-NEXT: vptestmd %xmm1, %xmm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb $15, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <4 x i64> %0, zeroinitializer
; AVX512BW-LABEL: icmp_v8i32_v8i1:
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
-; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
+; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: testb %al, %al
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v8i32_v8i1:
; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
+; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k0
; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: testb %al, %al
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <8 x i32> %0, zeroinitializer
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: kshiftrw $8, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $4, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $2, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrw $1, %k0, %k1
-; AVX512BW-NEXT: korw %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestw %k0, %k0
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v16i16_v16i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmw %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: kshiftrw $8, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $4, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $2, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrw $1, %k0, %k1
-; AVX512VL-NEXT: korw %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestw %k0, %k0
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <16 x i16> %0, zeroinitializer
; AVX512BW: # %bb.0:
; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: kshiftrd $16, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $8, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $4, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $2, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kshiftrd $1, %k0, %k1
-; AVX512BW-NEXT: kord %k1, %k0, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
+; AVX512BW-NEXT: kortestd %k0, %k0
+; AVX512BW-NEXT: setne %al
; AVX512BW-NEXT: vzeroupper
; AVX512BW-NEXT: retq
;
; AVX512VL-LABEL: icmp_v32i8_v32i1:
; AVX512VL: # %bb.0:
; AVX512VL-NEXT: vptestnmb %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: kshiftrd $16, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $8, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $4, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $2, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kshiftrd $1, %k0, %k1
-; AVX512VL-NEXT: kord %k1, %k0, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
+; AVX512VL-NEXT: kortestd %k0, %k0
+; AVX512VL-NEXT: setne %al
; AVX512VL-NEXT: vzeroupper
; AVX512VL-NEXT: retq
%a = icmp eq <32 x i8> %0, zeroinitializer
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
-; AVX512BW-LABEL: icmp_v8i64_v8i1:
-; AVX512BW: # %bb.0:
-; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti64x4 $1, %zmm0, %ymm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vextracti128 $1, %ymm0, %xmm0
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k1
-; AVX512BW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
-; AVX512BW-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
-; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
-; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
-; AVX512BW-NEXT: korw %k0, %k1, %k0
-; AVX512BW-NEXT: kmovd %k0, %eax
-; AVX512BW-NEXT: # kill: def $al killed $al killed $eax
-; AVX512BW-NEXT: vzeroupper
-; AVX512BW-NEXT: retq
-;
-; AVX512VL-LABEL: icmp_v8i64_v8i1:
-; AVX512VL: # %bb.0:
-; AVX512VL-NEXT: vptestnmq %zmm0, %zmm0, %k1
-; AVX512VL-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vextracti128 $1, %ymm1, %xmm1
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm1 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX512VL-NEXT: vpslld $31, %ymm1, %ymm1
-; AVX512VL-NEXT: vptestmd %ymm1, %ymm1, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k1
-; AVX512VL-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
-; AVX512VL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
-; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
-; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
-; AVX512VL-NEXT: korw %k0, %k1, %k0
-; AVX512VL-NEXT: kmovd %k0, %eax
-; AVX512VL-NEXT: # kill: def $al killed $al killed $eax
-; AVX512VL-NEXT: vzeroupper
-; AVX512VL-NEXT: retq
+; AVX512-LABEL: icmp_v8i64_v8i1:
+; AVX512: # %bb.0:
+; AVX512-NEXT: vptestnmq %zmm0, %zmm0, %k0
+; AVX512-NEXT: kmovd %k0, %eax
+; AVX512-NEXT: testb %al, %al
+; AVX512-NEXT: setne %al
+; AVX512-NEXT: vzeroupper
+; AVX512-NEXT: retq
%a = icmp eq <8 x i64> %0, zeroinitializer
%b = call i1 @llvm.experimental.vector.reduce.or.v8i1(<8 x i1> %a)
ret i1 %b
; AVX512-LABEL: icmp_v16i32_v16i1:
; AVX512: # %bb.0:
; AVX512-NEXT: vptestnmd %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrw $8, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $4, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $2, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kshiftrw $1, %k0, %k1
-; AVX512-NEXT: korw %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestw %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <16 x i32> %0, zeroinitializer
; AVX512-LABEL: icmp_v32i16_v32i1:
; AVX512: # %bb.0:
; AVX512-NEXT: vptestnmw %zmm0, %zmm0, %k0
-; AVX512-NEXT: kshiftrd $16, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $8, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $4, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $2, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kshiftrd $1, %k0, %k1
-; AVX512-NEXT: kord %k1, %k0, %k0
-; AVX512-NEXT: kmovd %k0, %eax
-; AVX512-NEXT: # kill: def $al killed $al killed $eax
+; AVX512-NEXT: kortestd %k0, %k0
+; AVX512-NEXT: setne %al
; AVX512-NEXT: vzeroupper
; AVX512-NEXT: retq
%a = icmp eq <32 x i16> %0, zeroinitializer