Index: lib/Target/X86/X86ISelLowering.cpp =================================================================== --- lib/Target/X86/X86ISelLowering.cpp +++ lib/Target/X86/X86ISelLowering.cpp @@ -11090,7 +11090,6 @@ unsigned NumLanes = (NumElems - 1) / 8 + 1; unsigned NumElemsInLane = NumElems / NumLanes; - // Blend for v16i16 should be symmetric for the both lanes. for (unsigned i = 0; i < NumElemsInLane; ++i) { SDValue EltCond = BuildVector->getOperand(i); SDValue SndLaneEltCond = @@ -11102,16 +11101,16 @@ if (isa(SndLaneEltCond)) Lane2Cond = !isZero(SndLaneEltCond); - if (Lane1Cond == Lane2Cond || Lane2Cond < 0) - // Lane1Cond != 0, means we want the first argument. - // Lane1Cond == 0, means we want the second argument. - // The encoding of this argument is 0 for the first argument, 1 - // for the second. Therefore, invert the condition. - MaskValue |= !Lane1Cond << i; - else if (Lane1Cond < 0) - MaskValue |= !Lane2Cond << i; - else + // Blend for v16i16 should be symmetric for the both lanes. + if (Lane1Cond != Lane2Cond) return false; + + // Lane1Cond != 0, means we want the first argument. + // Lane1Cond == 0, means we want the second argument. + // The encoding of this argument is 0 for the first argument, 1 + // for the second. Therefore, invert the condition. + MaskValue |= !Lane1Cond << i; + MaskValue |= !Lane2Cond << (i + NumElemsInLane); } return true; }