[llvm] r358286 - [X86][SSE] Recognise vXi1 boolean anyof/allof reduction patterns
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 07:22:57 PDT 2019
Author: rksimon
Date: Fri Apr 12 07:22:57 2019
New Revision: 358286
URL: http://llvm.org/viewvc/llvm-project?rev=358286&view=rev
Log:
[X86][SSE] Recognise vXi1 boolean anyof/allof reduction patterns
Currently combineHorizontalPredicateResult only handles anyof/allof reduction patterns of legal types, which can be tricky to match as type legalization of bools can introduce bitcasts/truncs/extensions.
This patch extends combineHorizontalPredicateResult to recognise vXi1 bool reductions as well and uses the existing combineBitcastvxi1 helper to create the MOVMSK necessary to then compare the signmask result.
This ensures the accuracy of the reduction costs added in D60403 which assume the MOVMSK generation.
Differential Revision: https://reviews.llvm.org/D60610
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
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=358286&r1=358285&r2=358286&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Apr 12 07:22:57 2019
@@ -34261,7 +34261,7 @@ static SDValue combineHorizontalPredicat
EVT ExtractVT = Extract->getValueType(0);
unsigned BitWidth = ExtractVT.getSizeInBits();
if (ExtractVT != MVT::i64 && ExtractVT != MVT::i32 && ExtractVT != MVT::i16 &&
- ExtractVT != MVT::i8)
+ ExtractVT != MVT::i8 && ExtractVT != MVT::i1)
return SDValue();
// Check for OR(any_of) and AND(all_of) horizontal reduction patterns.
@@ -34275,36 +34275,63 @@ static SDValue combineHorizontalPredicat
if (Match.getScalarValueSizeInBits() != BitWidth)
return SDValue();
- unsigned MatchSizeInBits = Match.getValueSizeInBits();
- if (!(MatchSizeInBits == 128 || (MatchSizeInBits == 256 && Subtarget.hasAVX())))
- return SDValue();
-
- // Make sure this isn't a vector of 1 element. The perf win from using MOVMSK
- // diminishes with less elements in the reduction, but it is generally better
- // to get the comparison over to the GPRs as soon as possible to reduce the
- // number of vector ops.
- if (Match.getValueType().getVectorNumElements() < 2)
- return SDValue();
-
- // Check that we are extracting a reduction of all sign bits.
- if (DAG.ComputeNumSignBits(Match) != BitWidth)
- return SDValue();
-
+ SDValue Movmsk;
SDLoc DL(Extract);
- if (MatchSizeInBits == 256 && BitWidth < 32 && !Subtarget.hasInt256()) {
- SDValue Lo, Hi;
- std::tie(Lo, Hi) = DAG.SplitVector(Match, DL);
- Match = DAG.getNode(BinOp, DL, Lo.getValueType(), Lo, Hi);
- MatchSizeInBits = Match.getValueSizeInBits();
- }
+ unsigned NumElts = Match.getValueType().getVectorNumElements();
- // For 32/64 bit comparisons use MOVMSKPS/MOVMSKPD, else PMOVMSKB.
- MVT MaskSrcVT;
- if (64 == BitWidth || 32 == BitWidth)
- MaskSrcVT = MVT::getVectorVT(MVT::getFloatingPointVT(BitWidth),
- MatchSizeInBits / BitWidth);
- else
- MaskSrcVT = MVT::getVectorVT(MVT::i8, MatchSizeInBits / 8);
+ 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;
+ }
+ 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 {
+ unsigned MatchSizeInBits = Match.getValueSizeInBits();
+ if (!(MatchSizeInBits == 128 ||
+ (MatchSizeInBits == 256 && Subtarget.hasAVX())))
+ return SDValue();
+
+ // Make sure this isn't a vector of 1 element. The perf win from using
+ // MOVMSK diminishes with less elements in the reduction, but it is
+ // generally better to get the comparison over to the GPRs as soon as
+ // possible to reduce the number of vector ops.
+ if (Match.getValueType().getVectorNumElements() < 2)
+ return SDValue();
+
+ // Check that we are extracting a reduction of all sign bits.
+ if (DAG.ComputeNumSignBits(Match) != BitWidth)
+ return SDValue();
+
+ if (MatchSizeInBits == 256 && BitWidth < 32 && !Subtarget.hasInt256()) {
+ SDValue Lo, Hi;
+ std::tie(Lo, Hi) = DAG.SplitVector(Match, DL);
+ Match = DAG.getNode(BinOp, DL, Lo.getValueType(), Lo, Hi);
+ MatchSizeInBits = Match.getValueSizeInBits();
+ }
+
+ // For 32/64 bit comparisons use MOVMSKPS/MOVMSKPD, else PMOVMSKB.
+ MVT MaskSrcVT;
+ if (64 == BitWidth || 32 == BitWidth)
+ MaskSrcVT = MVT::getVectorVT(MVT::getFloatingPointVT(BitWidth),
+ MatchSizeInBits / BitWidth);
+ else
+ MaskSrcVT = MVT::getVectorVT(MVT::i8, MatchSizeInBits / 8);
+
+ SDValue BitcastLogicOp = DAG.getBitcast(MaskSrcVT, Match);
+ Movmsk = getPMOVMSKB(DL, BitcastLogicOp, DAG, Subtarget);
+ NumElts = MaskSrcVT.getVectorNumElements();
+ }
+ assert(NumElts <= 32 && "Not expecting more than 32 elements");
SDValue CmpC;
ISD::CondCode CondCode;
@@ -34314,8 +34341,6 @@ static SDValue combineHorizontalPredicat
CondCode = ISD::CondCode::SETNE;
} else {
// all_of -> MOVMSK == ((1 << NumElts) - 1)
- uint64_t NumElts = MaskSrcVT.getVectorNumElements();
- assert(NumElts <= 32 && "Not expecting more than 32 elements");
CmpC = DAG.getConstant((1ULL << NumElts) - 1, DL, MVT::i32);
CondCode = ISD::CondCode::SETEQ;
}
@@ -34323,10 +34348,8 @@ static SDValue combineHorizontalPredicat
// The setcc produces an i8 of 0/1, so extend that to the result width and
// negate to get the final 0/-1 mask value.
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
- SDValue BitcastLogicOp = DAG.getBitcast(MaskSrcVT, Match);
- SDValue Movmsk = getPMOVMSKB(DL, BitcastLogicOp, DAG, Subtarget);
- EVT SetccVT = TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(),
- MVT::i32);
+ EVT SetccVT =
+ TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), MVT::i32);
SDValue Setcc = DAG.getSetCC(DL, SetccVT, Movmsk, CmpC, CondCode);
SDValue Zext = DAG.getZExtOrTrunc(Setcc, DL, ExtractVT);
SDValue Zero = DAG.getConstant(0, DL, ExtractVT);
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=358286&r1=358285&r2=358286&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-compare-all_of.ll Fri Apr 12 07:22:57 2019
@@ -920,19 +920,17 @@ define i1 @bool_reduction_v2f64(<2 x dou
; SSE-LABEL: bool_reduction_v2f64:
; SSE: # %bb.0:
; SSE-NEXT: cmpltpd %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
-; SSE-NEXT: pand %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskpd %xmm1, %eax
+; SSE-NEXT: cmpb $3, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v2f64:
; AVX: # %bb.0:
; AVX-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
-; AVX-NEXT: vandpd %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %xmm0, %eax
+; AVX-NEXT: cmpb $3, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v2f64:
@@ -957,23 +955,17 @@ define i1 @bool_reduction_v4f32(<4 x flo
; SSE-LABEL: bool_reduction_v4f32:
; SSE: # %bb.0:
; SSE-NEXT: cmpeqps %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
-; SSE-NEXT: pand %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskps %xmm0, %eax
+; SSE-NEXT: cmpb $15, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4f32:
; AVX: # %bb.0:
; AVX-NEXT: vcmpeqps %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
-; AVX-NEXT: vandpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpermilps {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vandpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskps %xmm0, %eax
+; AVX-NEXT: cmpb $15, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v4f32:
@@ -1005,27 +997,18 @@ define i1 @bool_reduction_v4f64(<4 x dou
; SSE: # %bb.0:
; SSE-NEXT: cmplepd %xmm1, %xmm3
; SSE-NEXT: cmplepd %xmm0, %xmm2
-; SSE-NEXT: movapd %xmm2, %xmm0
-; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm3[0,2]
-; SSE-NEXT: shufps {{.*#+}} xmm3 = xmm3[0,2],xmm2[0,2]
-; SSE-NEXT: andps %xmm0, %xmm3
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,2,3]
-; SSE-NEXT: pand %xmm3, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packssdw %xmm3, %xmm2
+; SSE-NEXT: movmskps %xmm2, %eax
+; SSE-NEXT: cmpb $15, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4f64:
; AVX: # %bb.0:
; AVX-NEXT: vcmplepd %ymm0, %ymm1, %ymm0
-; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
-; AVX-NEXT: vpackssdw %xmm1, %xmm0, %xmm2
-; AVX-NEXT: vpackssdw %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpand %xmm2, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %ymm0, %eax
+; AVX-NEXT: cmpb $15, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: vzeroupper
; AVX-NEXT: retq
;
@@ -1119,10 +1102,9 @@ define i1 @bool_reduction_v2i64(<2 x i64
; SSE-NEXT: pxor %xmm2, %xmm1
; SSE-NEXT: pxor %xmm2, %xmm0
; SSE-NEXT: pcmpgtq %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskpd %xmm0, %eax
+; SSE-NEXT: cmpb $3, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v2i64:
@@ -1131,10 +1113,9 @@ define i1 @bool_reduction_v2i64(<2 x i64
; AVX-NEXT: vpxor %xmm2, %xmm1, %xmm1
; AVX-NEXT: vpxor %xmm2, %xmm0, %xmm0
; AVX-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %xmm0, %eax
+; AVX-NEXT: cmpb $3, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v2i64:
@@ -1161,25 +1142,19 @@ define i1 @bool_reduction_v4i32(<4 x i32
; SSE-NEXT: pcmpeqd %xmm1, %xmm0
; SSE-NEXT: pcmpeqd %xmm1, %xmm1
; SSE-NEXT: pxor %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; SSE-NEXT: pandn %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskps %xmm1, %eax
+; SSE-NEXT: cmpb $15, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4i32:
; AVX: # %bb.0:
; AVX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm1
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vmovmskps %xmm0, %eax
+; AVX-NEXT: cmpb $15, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v4i32:
@@ -1210,28 +1185,19 @@ define i1 @bool_reduction_v8i16(<8 x i16
; SSE-LABEL: bool_reduction_v8i16:
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtw %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
-; SSE-NEXT: pand %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: movdqa %xmm1, %xmm0
-; SSE-NEXT: psrld $16, %xmm0
-; SSE-NEXT: pand %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packsswb %xmm0, %xmm1
+; SSE-NEXT: pmovmskb %xmm1, %eax
+; SSE-NEXT: cmpb $-1, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v8i16:
; AVX: # %bb.0:
; AVX-NEXT: vpcmpgtw %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
+; AVX-NEXT: vpmovmskb %xmm0, %eax
+; AVX-NEXT: cmpb $-1, %al
+; AVX-NEXT: sete %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v8i16:
@@ -1270,18 +1236,16 @@ define i1 @bool_reduction_v16i8(<16 x i8
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtb %xmm1, %xmm0
; SSE-NEXT: pmovmskb %xmm0, %eax
-; SSE-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; SSE-NEXT: cmpw $-1, %ax
; SSE-NEXT: sete %al
-; SSE-NEXT: negb %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v16i8:
; AVX: # %bb.0:
; AVX-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
; AVX-NEXT: vpmovmskb %xmm0, %eax
-; AVX-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX-NEXT: cmpw $-1, %ax
; AVX-NEXT: sete %al
-; AVX-NEXT: negb %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v16i8:
@@ -1316,13 +1280,10 @@ define i1 @bool_reduction_v4i64(<4 x i64
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtq %xmm1, %xmm3
; SSE-NEXT: pcmpgtq %xmm0, %xmm2
-; SSE-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,0,1]
-; SSE-NEXT: pand %xmm2, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packssdw %xmm3, %xmm2
+; SSE-NEXT: movmskps %xmm2, %eax
+; SSE-NEXT: cmpb $15, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v4i64:
@@ -1331,27 +1292,19 @@ define i1 @bool_reduction_v4i64(<4 x i64
; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm1
-; AVX1-NEXT: vpackssdw %xmm0, %xmm2, %xmm0
-; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpextrb $0, %xmm0, %eax
-; AVX1-NEXT: # kill: def $al killed $al killed $eax
+; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; AVX1-NEXT: vmovmskpd %ymm0, %eax
+; AVX1-NEXT: cmpb $15, %al
+; AVX1-NEXT: sete %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
; AVX2-LABEL: bool_reduction_v4i64:
; AVX2: # %bb.0:
; AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm0
-; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm2
-; AVX2-NEXT: vpackssdw %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpextrb $0, %xmm0, %eax
-; AVX2-NEXT: # kill: def $al killed $al killed $eax
+; AVX2-NEXT: vmovmskpd %ymm0, %eax
+; AVX2-NEXT: cmpb $15, %al
+; AVX2-NEXT: sete %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1388,15 +1341,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
; SSE-NEXT: pminud %xmm0, %xmm2
; SSE-NEXT: pcmpeqd %xmm0, %xmm2
; SSE-NEXT: packssdw %xmm3, %xmm2
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,0,1]
-; SSE-NEXT: pand %xmm2, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: movdqa %xmm1, %xmm0
-; SSE-NEXT: psrld $16, %xmm0
-; SSE-NEXT: pand %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packsswb %xmm0, %xmm2
+; SSE-NEXT: pmovmskb %xmm2, %eax
+; SSE-NEXT: cmpb $-1, %al
+; SSE-NEXT: sete %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v8i32:
@@ -1407,15 +1355,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
; AVX1-NEXT: vpcmpeqd %xmm2, %xmm3, %xmm2
; AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm1
; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpextrb $0, %xmm0, %eax
-; AVX1-NEXT: # kill: def $al killed $al killed $eax
+; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; AVX1-NEXT: vmovmskps %ymm0, %eax
+; AVX1-NEXT: cmpb $-1, %al
+; AVX1-NEXT: sete %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1423,16 +1366,9 @@ define i1 @bool_reduction_v8i32(<8 x i32
; AVX2: # %bb.0:
; AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm1
; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
-; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpextrb $0, %xmm0, %eax
-; AVX2-NEXT: # kill: def $al killed $al killed $eax
+; AVX2-NEXT: vmovmskps %ymm0, %eax
+; AVX2-NEXT: cmpb $-1, %al
+; AVX2-NEXT: sete %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1474,9 +1410,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; SSE-NEXT: pcmpeqw %xmm2, %xmm0
; SSE-NEXT: packsswb %xmm1, %xmm0
; SSE-NEXT: pmovmskb %xmm0, %eax
-; SSE-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; SSE-NEXT: cmpw $-1, %ax
; SSE-NEXT: sete %al
-; SSE-NEXT: negb %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v16i16:
@@ -1487,9 +1422,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
; AVX1-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
; AVX1-NEXT: vpmovmskb %xmm0, %eax
-; AVX1-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX1-NEXT: cmpw $-1, %ax
; AVX1-NEXT: sete %al
-; AVX1-NEXT: negb %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1499,9 +1433,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
; AVX2-NEXT: vpmovmskb %xmm0, %eax
-; AVX2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX2-NEXT: cmpw $-1, %ax
; AVX2-NEXT: sete %al
-; AVX2-NEXT: negb %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1536,13 +1469,12 @@ define i1 @bool_reduction_v16i16(<16 x i
define i1 @bool_reduction_v32i8(<32 x i8> %x, <32 x i8> %y) {
; SSE-LABEL: bool_reduction_v32i8:
; SSE: # %bb.0:
-; SSE-NEXT: pcmpeqb %xmm2, %xmm0
; SSE-NEXT: pcmpeqb %xmm3, %xmm1
-; SSE-NEXT: pand %xmm0, %xmm1
-; SSE-NEXT: pmovmskb %xmm1, %eax
-; SSE-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; SSE-NEXT: pcmpeqb %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
+; SSE-NEXT: pmovmskb %xmm0, %eax
+; SSE-NEXT: cmpw $-1, %ax
; SSE-NEXT: sete %al
-; SSE-NEXT: negb %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v32i8:
@@ -1553,9 +1485,8 @@ define i1 @bool_reduction_v32i8(<32 x i8
; AVX1-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
; AVX1-NEXT: vpmovmskb %xmm0, %eax
-; AVX1-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX1-NEXT: cmpw $-1, %ax
; AVX1-NEXT: sete %al
-; AVX1-NEXT: negb %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1565,7 +1496,6 @@ define i1 @bool_reduction_v32i8(<32 x i8
; AVX2-NEXT: vpmovmskb %ymm0, %eax
; AVX2-NEXT: cmpl $-1, %eax
; AVX2-NEXT: sete %al
-; AVX2-NEXT: negb %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
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=358286&r1=358285&r2=358286&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll (original)
+++ llvm/trunk/test/CodeGen/X86/vector-compare-any_of.ll Fri Apr 12 07:22:57 2019
@@ -840,19 +840,17 @@ define i1 @bool_reduction_v2f64(<2 x dou
; SSE-LABEL: bool_reduction_v2f64:
; SSE: # %bb.0:
; SSE-NEXT: cmpltpd %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskpd %xmm1, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v2f64:
; AVX: # %bb.0:
; AVX-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
-; AVX-NEXT: vorpd %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %xmm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v2f64:
@@ -878,23 +876,17 @@ define i1 @bool_reduction_v4f32(<4 x flo
; SSE-LABEL: bool_reduction_v4f32:
; SSE: # %bb.0:
; SSE-NEXT: cmpeqps %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,2,3]
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskps %xmm0, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4f32:
; AVX: # %bb.0:
; AVX-NEXT: vcmpeqps %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpermilpd {{.*#+}} xmm1 = xmm0[1,0]
-; AVX-NEXT: vorpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpermilps {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vorpd %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskps %xmm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v4f32:
@@ -928,27 +920,18 @@ define i1 @bool_reduction_v4f64(<4 x dou
; SSE: # %bb.0:
; SSE-NEXT: cmplepd %xmm1, %xmm3
; SSE-NEXT: cmplepd %xmm0, %xmm2
-; SSE-NEXT: movapd %xmm2, %xmm0
-; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm3[0,2]
-; SSE-NEXT: shufps {{.*#+}} xmm3 = xmm3[0,2],xmm2[0,2]
-; SSE-NEXT: orps %xmm0, %xmm3
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm3[1,1,2,3]
-; SSE-NEXT: por %xmm3, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packssdw %xmm3, %xmm2
+; SSE-NEXT: movmskps %xmm2, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4f64:
; AVX: # %bb.0:
; AVX-NEXT: vcmplepd %ymm0, %ymm1, %ymm0
-; AVX-NEXT: vextractf128 $1, %ymm0, %xmm1
-; AVX-NEXT: vpackssdw %xmm1, %xmm0, %xmm2
-; AVX-NEXT: vpackssdw %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpor %xmm2, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %ymm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: vzeroupper
; AVX-NEXT: retq
;
@@ -1046,10 +1029,9 @@ define i1 @bool_reduction_v2i64(<2 x i64
; SSE-NEXT: pxor %xmm2, %xmm1
; SSE-NEXT: pxor %xmm2, %xmm0
; SSE-NEXT: pcmpgtq %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskpd %xmm0, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v2i64:
@@ -1058,10 +1040,9 @@ define i1 @bool_reduction_v2i64(<2 x i64
; AVX-NEXT: vpxor %xmm2, %xmm1, %xmm1
; AVX-NEXT: vpxor %xmm2, %xmm0, %xmm0
; AVX-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-NEXT: vpor %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskpd %xmm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v2i64:
@@ -1089,12 +1070,9 @@ define i1 @bool_reduction_v4i32(<4 x i32
; SSE-NEXT: pcmpeqd %xmm1, %xmm0
; SSE-NEXT: pcmpeqd %xmm1, %xmm1
; SSE-NEXT: pxor %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: movmskps %xmm1, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v4i32:
@@ -1102,12 +1080,9 @@ define i1 @bool_reduction_v4i32(<4 x i32
; AVX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vmovmskps %xmm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v4i32:
@@ -1140,28 +1115,19 @@ define i1 @bool_reduction_v8i16(<8 x i16
; SSE-LABEL: bool_reduction_v8i16:
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtw %xmm0, %xmm1
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm1[2,3,0,1]
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: movdqa %xmm1, %xmm0
-; SSE-NEXT: psrld $16, %xmm0
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packsswb %xmm0, %xmm1
+; SSE-NEXT: pmovmskb %xmm1, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v8i16:
; AVX: # %bb.0:
; AVX-NEXT: vpcmpgtw %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX-NEXT: vpextrb $0, %xmm0, %eax
-; AVX-NEXT: # kill: def $al killed $al killed $eax
+; AVX-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
+; AVX-NEXT: vpmovmskb %xmm0, %eax
+; AVX-NEXT: testb %al, %al
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v8i16:
@@ -1203,16 +1169,16 @@ define i1 @bool_reduction_v16i8(<16 x i8
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtb %xmm1, %xmm0
; SSE-NEXT: pmovmskb %xmm0, %eax
-; SSE-NEXT: negl %eax
-; SSE-NEXT: sbbb %al, %al
+; SSE-NEXT: testw %ax, %ax
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX-LABEL: bool_reduction_v16i8:
; AVX: # %bb.0:
; AVX-NEXT: vpcmpgtb %xmm1, %xmm0, %xmm0
; AVX-NEXT: vpmovmskb %xmm0, %eax
-; AVX-NEXT: negl %eax
-; AVX-NEXT: sbbb %al, %al
+; AVX-NEXT: testw %ax, %ax
+; AVX-NEXT: setne %al
; AVX-NEXT: retq
;
; AVX512-LABEL: bool_reduction_v16i8:
@@ -1247,13 +1213,10 @@ define i1 @bool_reduction_v4i64(<4 x i64
; SSE: # %bb.0:
; SSE-NEXT: pcmpgtq %xmm1, %xmm3
; SSE-NEXT: pcmpgtq %xmm0, %xmm2
-; SSE-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,0,1]
-; SSE-NEXT: por %xmm2, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: pextrb $0, %xmm1, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packssdw %xmm3, %xmm2
+; SSE-NEXT: movmskps %xmm2, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v4i64:
@@ -1262,27 +1225,19 @@ define i1 @bool_reduction_v4i64(<4 x i64
; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
; AVX1-NEXT: vpcmpgtq %xmm2, %xmm3, %xmm2
; AVX1-NEXT: vpcmpgtq %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm1
-; AVX1-NEXT: vpackssdw %xmm0, %xmm2, %xmm0
-; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX1-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpextrb $0, %xmm0, %eax
-; AVX1-NEXT: # kill: def $al killed $al killed $eax
+; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; AVX1-NEXT: vmovmskpd %ymm0, %eax
+; AVX1-NEXT: testb %al, %al
+; AVX1-NEXT: setne %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
; AVX2-LABEL: bool_reduction_v4i64:
; AVX2: # %bb.0:
; AVX2-NEXT: vpcmpgtq %ymm0, %ymm1, %ymm0
-; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm2
-; AVX2-NEXT: vpackssdw %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpor %xmm2, %xmm0, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX2-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpextrb $0, %xmm0, %eax
-; AVX2-NEXT: # kill: def $al killed $al killed $eax
+; AVX2-NEXT: vmovmskpd %ymm0, %eax
+; AVX2-NEXT: testb %al, %al
+; AVX2-NEXT: setne %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1321,15 +1276,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
; SSE-NEXT: pminud %xmm0, %xmm2
; SSE-NEXT: pcmpeqd %xmm0, %xmm2
; SSE-NEXT: packssdw %xmm3, %xmm2
-; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm2[2,3,0,1]
-; SSE-NEXT: por %xmm2, %xmm0
-; SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: movdqa %xmm1, %xmm0
-; SSE-NEXT: psrld $16, %xmm0
-; SSE-NEXT: por %xmm1, %xmm0
-; SSE-NEXT: pextrb $0, %xmm0, %eax
-; SSE-NEXT: # kill: def $al killed $al killed $eax
+; SSE-NEXT: packsswb %xmm0, %xmm2
+; SSE-NEXT: pmovmskb %xmm2, %eax
+; SSE-NEXT: testb %al, %al
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v8i32:
@@ -1340,15 +1290,10 @@ define i1 @bool_reduction_v8i32(<8 x i32
; AVX1-NEXT: vpcmpeqd %xmm2, %xmm3, %xmm2
; AVX1-NEXT: vpminud %xmm1, %xmm0, %xmm1
; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX1-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX1-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX1-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: vpextrb $0, %xmm0, %eax
-; AVX1-NEXT: # kill: def $al killed $al killed $eax
+; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
+; AVX1-NEXT: vmovmskps %ymm0, %eax
+; AVX1-NEXT: testb %al, %al
+; AVX1-NEXT: setne %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1356,16 +1301,9 @@ define i1 @bool_reduction_v8i32(<8 x i32
; AVX2: # %bb.0:
; AVX2-NEXT: vpminud %ymm1, %ymm0, %ymm1
; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
-; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX2-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
-; AVX2-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpsrld $16, %xmm0, %xmm1
-; AVX2-NEXT: vpor %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: vpextrb $0, %xmm0, %eax
-; AVX2-NEXT: # kill: def $al killed $al killed $eax
+; AVX2-NEXT: vmovmskps %ymm0, %eax
+; AVX2-NEXT: testb %al, %al
+; AVX2-NEXT: setne %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1410,8 +1348,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; SSE-NEXT: pcmpeqw %xmm2, %xmm0
; SSE-NEXT: packsswb %xmm1, %xmm0
; SSE-NEXT: pmovmskb %xmm0, %eax
-; SSE-NEXT: negl %eax
-; SSE-NEXT: sbbb %al, %al
+; SSE-NEXT: testw %ax, %ax
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v16i16:
@@ -1422,8 +1360,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
; AVX1-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
; AVX1-NEXT: vpmovmskb %xmm0, %eax
-; AVX1-NEXT: negl %eax
-; AVX1-NEXT: sbbb %al, %al
+; AVX1-NEXT: testw %ax, %ax
+; AVX1-NEXT: setne %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1433,8 +1371,8 @@ define i1 @bool_reduction_v16i16(<16 x i
; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
; AVX2-NEXT: vpmovmskb %xmm0, %eax
-; AVX2-NEXT: negl %eax
-; AVX2-NEXT: sbbb %al, %al
+; AVX2-NEXT: testw %ax, %ax
+; AVX2-NEXT: setne %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
@@ -1469,12 +1407,12 @@ define i1 @bool_reduction_v16i16(<16 x i
define i1 @bool_reduction_v32i8(<32 x i8> %x, <32 x i8> %y) {
; SSE-LABEL: bool_reduction_v32i8:
; SSE: # %bb.0:
-; SSE-NEXT: pcmpeqb %xmm2, %xmm0
; SSE-NEXT: pcmpeqb %xmm3, %xmm1
-; SSE-NEXT: por %xmm0, %xmm1
-; SSE-NEXT: pmovmskb %xmm1, %eax
-; SSE-NEXT: negl %eax
-; SSE-NEXT: sbbb %al, %al
+; SSE-NEXT: pcmpeqb %xmm2, %xmm0
+; SSE-NEXT: por %xmm1, %xmm0
+; SSE-NEXT: pmovmskb %xmm0, %eax
+; SSE-NEXT: testw %ax, %ax
+; SSE-NEXT: setne %al
; SSE-NEXT: retq
;
; AVX1-LABEL: bool_reduction_v32i8:
@@ -1485,8 +1423,8 @@ define i1 @bool_reduction_v32i8(<32 x i8
; AVX1-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
; AVX1-NEXT: vpor %xmm2, %xmm0, %xmm0
; AVX1-NEXT: vpmovmskb %xmm0, %eax
-; AVX1-NEXT: negl %eax
-; AVX1-NEXT: sbbb %al, %al
+; AVX1-NEXT: testw %ax, %ax
+; AVX1-NEXT: setne %al
; AVX1-NEXT: vzeroupper
; AVX1-NEXT: retq
;
@@ -1494,8 +1432,8 @@ define i1 @bool_reduction_v32i8(<32 x i8
; AVX2: # %bb.0:
; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
; AVX2-NEXT: vpmovmskb %ymm0, %eax
-; AVX2-NEXT: negl %eax
-; AVX2-NEXT: sbbb %al, %al
+; AVX2-NEXT: testl %eax, %eax
+; AVX2-NEXT: setne %al
; AVX2-NEXT: vzeroupper
; AVX2-NEXT: retq
;
More information about the llvm-commits
mailing list