[llvm] r359386 - [X86][AVX512] Improve vector bool reductions
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 27 10:32:47 PDT 2019
Author: rksimon
Date: Sat Apr 27 10:32:46 2019
New Revision: 359386
URL: http://llvm.org/viewvc/llvm-project?rev=359386&view=rev
Log:
[X86][AVX512] Improve vector bool reductions
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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll
llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll
llvm/trunk/test/CodeGen/X86/vector-reduce-and-bool.ll
llvm/trunk/test/CodeGen/X86/vector-reduce-or-bool.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=359386&r1=359385&r2=359386&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Apr 27 10:32:46 2019
@@ -34390,8 +34390,8 @@ static SDValue combineHorizontalMinMaxRe
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);
@@ -34413,25 +34413,36 @@ static SDValue combineHorizontalPredicat
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())))
Modified: llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll?rev=359386&r1=359385&r2=359386&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll Sat Apr 27 10:32:46 2019
@@ -935,14 +935,11 @@ define i1 @bool_reduction_v2f64(<2 x dou
;
; 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>
@@ -970,18 +967,11 @@ define i1 @bool_reduction_v4f32(<4 x flo
;
; 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>
@@ -1014,18 +1004,11 @@ define i1 @bool_reduction_v4f64(<4 x dou
;
; 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
@@ -1060,22 +1043,10 @@ define i1 @bool_reduction_v8f32(<8 x flo
;
; 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
@@ -1114,14 +1085,11 @@ define i1 @bool_reduction_v2i64(<2 x i64
;
; 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>
@@ -1153,18 +1121,11 @@ define i1 @bool_reduction_v4i32(<4 x i32
;
; 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>
@@ -1196,23 +1157,10 @@ define i1 @bool_reduction_v8i16(<8 x i16
;
; 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>
@@ -1245,16 +1193,8 @@ define i1 @bool_reduction_v16i8(<16 x i8
; 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>
@@ -1304,18 +1244,11 @@ define i1 @bool_reduction_v4i64(<4 x i64
;
; 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
@@ -1368,22 +1301,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
;
; 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
@@ -1435,16 +1356,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; 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
@@ -1496,18 +1409,8 @@ define i1 @bool_reduction_v32i8(<32 x i8
; 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
Modified: llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll?rev=359386&r1=359385&r2=359386&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll Sat Apr 27 10:32:46 2019
@@ -855,15 +855,10 @@ define i1 @bool_reduction_v2f64(<2 x dou
;
; 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>
@@ -891,20 +886,10 @@ define i1 @bool_reduction_v4f32(<4 x flo
;
; 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>
@@ -937,20 +922,10 @@ define i1 @bool_reduction_v4f64(<4 x dou
;
; 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
@@ -985,25 +960,10 @@ define i1 @bool_reduction_v8f32(<8 x flo
;
; 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
@@ -1042,15 +1002,10 @@ define i1 @bool_reduction_v2i64(<2 x i64
;
; 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>
@@ -1082,20 +1037,10 @@ define i1 @bool_reduction_v4i32(<4 x i32
;
; 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>
@@ -1127,26 +1072,10 @@ define i1 @bool_reduction_v8i16(<8 x i16
;
; 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>
@@ -1179,16 +1108,8 @@ define i1 @bool_reduction_v16i8(<16 x i8
; 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>
@@ -1238,20 +1159,10 @@ define i1 @bool_reduction_v4i64(<4 x i64
;
; 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
@@ -1304,25 +1215,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
;
; 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
@@ -1374,16 +1270,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; 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
@@ -1435,18 +1323,8 @@ define i1 @bool_reduction_v32i8(<32 x i8
; 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
Modified: llvm/trunk/test/CodeGen/X86/vector-reduce-and-bool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-reduce-and-bool.ll?rev=359386&r1=359385&r2=359386&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-reduce-and-bool.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-reduce-and-bool.ll Sat Apr 27 10:32:46 2019
@@ -30,27 +30,22 @@ define i1 @trunc_v2i64_v2i1(<2 x i64>) {
; 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)
@@ -77,35 +72,22 @@ define i1 @trunc_v4i32_v4i1(<4 x i32>) {
; 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)
@@ -134,44 +116,20 @@ define i1 @trunc_v8i16_v8i1(<8 x i8>) {
; 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)
@@ -195,39 +153,13 @@ define i1 @trunc_v16i8_v16i1(<16 x i8>)
; 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
@@ -257,35 +189,22 @@ define i1 @trunc_v4i64_v4i1(<4 x i64>) {
; 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>
@@ -351,43 +270,20 @@ define i1 @trunc_v8i32_v8i1(<8 x i32>) {
; 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>
@@ -448,17 +344,8 @@ define i1 @trunc_v16i16_v16i1(<16 x i16>
; 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
;
@@ -466,16 +353,8 @@ define i1 @trunc_v16i16_v16i1(<16 x i16>
; 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>
@@ -513,44 +392,14 @@ define i1 @trunc_v32i8_v32i1(<32 x i8>)
; 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
@@ -629,48 +478,15 @@ define i1 @trunc_v8i64_v8i1(<8 x i64>) {
; 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
@@ -748,16 +564,8 @@ define i1 @trunc_v16i32_v16i1(<16 x i32>
; 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>
@@ -832,18 +640,8 @@ define i1 @trunc_v32i16_v32i1(<32 x i16>
; 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>
@@ -988,26 +786,21 @@ define i1 @icmp_v2i64_v2i1(<2 x i64>) {
; 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)
@@ -1036,34 +829,21 @@ define i1 @icmp_v4i32_v4i1(<4 x i32>) {
; 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)
@@ -1097,43 +877,19 @@ define i1 @icmp_v8i16_v8i1(<8 x i8>) {
; 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)
@@ -1163,33 +919,16 @@ define i1 @icmp_v16i8_v16i1(<16 x i8>) {
; 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)
@@ -1249,34 +988,21 @@ define i1 @icmp_v4i64_v4i1(<4 x i64>) {
; 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
@@ -1323,42 +1049,19 @@ define i1 @icmp_v8i32_v8i1(<8 x i32>) {
; 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
@@ -1407,33 +1110,16 @@ define i1 @icmp_v16i16_v16i1(<16 x i16>)
; 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
@@ -1479,37 +1165,16 @@ define i1 @icmp_v32i8_v32i1(<32 x i8>) {
; 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
@@ -1589,46 +1254,14 @@ define i1 @icmp_v8i64_v8i1(<8 x i64>) {
; 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
@@ -1686,16 +1319,8 @@ define i1 @icmp_v16i32_v16i1(<16 x i32>)
; 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
@@ -1754,18 +1379,8 @@ define i1 @icmp_v32i16_v32i1(<32 x i16>)
; 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
Modified: llvm/trunk/test/CodeGen/X86/vector-reduce-or-bool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vector-reduce-or-bool.ll?rev=359386&r1=359385&r2=359386&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-reduce-or-bool.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-reduce-or-bool.ll Sat Apr 27 10:32:46 2019
@@ -30,29 +30,20 @@ define i1 @trunc_v2i64_v2i1(<2 x i64>) {
; 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)
@@ -79,39 +70,20 @@ define i1 @trunc_v4i32_v4i1(<4 x i32>) {
; 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)
@@ -140,50 +112,20 @@ define i1 @trunc_v8i16_v8i1(<8 x i8>) {
; 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)
@@ -207,38 +149,13 @@ define i1 @trunc_v16i8_v16i1(<16 x i8>)
; 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
@@ -268,39 +185,20 @@ define i1 @trunc_v4i64_v4i1(<4 x i64>) {
; 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>
@@ -366,49 +264,20 @@ define i1 @trunc_v8i32_v8i1(<8 x i32>) {
; 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>
@@ -469,16 +338,8 @@ define i1 @trunc_v16i16_v16i1(<16 x i16>
; 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
;
@@ -486,16 +347,8 @@ define i1 @trunc_v16i16_v16i1(<16 x i16>
; 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>
@@ -533,43 +386,14 @@ define i1 @trunc_v32i8_v32i1(<32 x i8>)
; 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
@@ -648,54 +472,15 @@ define i1 @trunc_v8i64_v8i1(<8 x i64>) {
; 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
@@ -773,16 +558,8 @@ define i1 @trunc_v16i32_v16i1(<16 x i32>
; 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>
@@ -857,18 +634,8 @@ define i1 @trunc_v32i16_v32i1(<32 x i16>
; 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>
@@ -1013,28 +780,19 @@ define i1 @icmp_v2i64_v2i1(<2 x i64>) {
; 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)
@@ -1063,38 +821,19 @@ define i1 @icmp_v4i32_v4i1(<4 x i32>) {
; 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)
@@ -1128,49 +867,19 @@ define i1 @icmp_v8i16_v8i1(<8 x i8>) {
; 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)
@@ -1200,32 +909,16 @@ define i1 @icmp_v16i8_v16i1(<16 x i8>) {
; 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)
@@ -1285,38 +978,19 @@ define i1 @icmp_v4i64_v4i1(<4 x i64>) {
; 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
@@ -1363,48 +1037,19 @@ define i1 @icmp_v8i32_v8i1(<8 x i32>) {
; 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
@@ -1453,32 +1098,16 @@ define i1 @icmp_v16i16_v16i1(<16 x i16>)
; 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
@@ -1525,36 +1154,16 @@ define i1 @icmp_v32i8_v32i1(<32 x i8>) {
; 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
@@ -1634,52 +1243,14 @@ define i1 @icmp_v8i64_v8i1(<8 x i64>) {
; 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
@@ -1737,16 +1308,8 @@ define i1 @icmp_v16i32_v16i1(<16 x i32>)
; 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
@@ -1805,18 +1368,8 @@ define i1 @icmp_v32i16_v32i1(<32 x i16>)
; 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
More information about the llvm-commits
mailing list