Index: lib/Target/X86/X86ISelLowering.cpp =================================================================== --- lib/Target/X86/X86ISelLowering.cpp +++ lib/Target/X86/X86ISelLowering.cpp @@ -34261,7 +34261,7 @@ 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 @@ if (Match.getScalarValueSizeInBits() != BitWidth) return SDValue(); - unsigned MatchSizeInBits = Match.getValueSizeInBits(); - if (!(MatchSizeInBits == 128 || (MatchSizeInBits == 256 && Subtarget.hasAVX()))) - return SDValue(); + SDValue Movmsk; + SDLoc DL(Extract); + unsigned NumElts = Match.getValueType().getVectorNumElements(); - // 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(); + 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(); - // Check that we are extracting a reduction of all sign bits. - if (DAG.ComputeNumSignBits(Match) != BitWidth) - 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(); - 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(); - } + // Check that we are extracting a reduction of all sign bits. + if (DAG.ComputeNumSignBits(Match) != BitWidth) + return SDValue(); - // 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 (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 @@ 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 @@ // 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); Index: test/CodeGen/X86/vector-compare-all_of.ll =================================================================== --- test/CodeGen/X86/vector-compare-all_of.ll +++ test/CodeGen/X86/vector-compare-all_of.ll @@ -920,19 +920,17 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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_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 @@ ; 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 @@ ; AVX2-NEXT: vpmovmskb %ymm0, %eax ; AVX2-NEXT: cmpl $-1, %eax ; AVX2-NEXT: sete %al -; AVX2-NEXT: negb %al ; AVX2-NEXT: vzeroupper ; AVX2-NEXT: retq ; Index: test/CodeGen/X86/vector-compare-any_of.ll =================================================================== --- test/CodeGen/X86/vector-compare-any_of.ll +++ test/CodeGen/X86/vector-compare-any_of.ll @@ -840,19 +840,17 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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 @@ ; 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_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 @@ ; 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 @@ ; 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 ;