| Index: lib/Target/X86/X86ISelLowering.cpp
|
| diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
|
| index d0ad0bb70208741c7b53aa8191d8ced4f6826be3..2179a593a624101dfb8fbd5093c61bfc03c89357 100644
|
| --- a/lib/Target/X86/X86ISelLowering.cpp
|
| +++ b/lib/Target/X86/X86ISelLowering.cpp
|
| @@ -9448,31 +9448,29 @@ static SDValue LowerVSETCC(SDValue Op, const X86Subtarget *Subtarget,
|
| if (Swap)
|
| std::swap(Op0, Op1);
|
|
|
| + // Since SSE has no unsigned integer comparisons, we need to flip the sign
|
| + // bits of the inputs before performing those operations.
|
| + if (FlipSigns) {
|
| + EVT EltVT = VT.getVectorElementType();
|
| + SDValue SignBit = DAG.getConstant(APInt::getSignBit(EltVT.getSizeInBits()),
|
| + EltVT);
|
| + std::vector<SDValue> SignBits(VT.getVectorNumElements(), SignBit);
|
| + SDValue SignVec = DAG.getNode(ISD::BUILD_VECTOR, dl, VT, &SignBits[0],
|
| + SignBits.size());
|
| + Op0 = DAG.getNode(ISD::XOR, dl, VT, Op0, SignVec);
|
| + Op1 = DAG.getNode(ISD::XOR, dl, VT, Op1, SignVec);
|
| + }
|
| +
|
| // Check that the operation in question is available (most are plain SSE2,
|
| // but PCMPGTQ and PCMPEQQ have different requirements).
|
| if (VT == MVT::v2i64) {
|
| if (Opc == X86ISD::PCMPGT && !Subtarget->hasSSE42()) {
|
| assert(Subtarget->hasSSE2() && "Don't know how to lower!");
|
|
|
| - // First cast everything to the right type.
|
| + // First cast everything to the right type,
|
| Op0 = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, Op0);
|
| Op1 = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, Op1);
|
|
|
| - // Since SSE has no unsigned integer comparisons, we need to flip the sign
|
| - // bits of the inputs before performing those operations. The lower
|
| - // compare is always unsigned.
|
| - SDValue SB;
|
| - if (FlipSigns) {
|
| - SB = DAG.getConstant(0x80000000U, MVT::v4i32);
|
| - } else {
|
| - SDValue Sign = DAG.getConstant(0x80000000U, MVT::i32);
|
| - SDValue Zero = DAG.getConstant(0x00000000U, MVT::i32);
|
| - SB = DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v4i32,
|
| - Sign, Zero, Sign, Zero);
|
| - }
|
| - Op0 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op0, SB);
|
| - Op1 = DAG.getNode(ISD::XOR, dl, MVT::v4i32, Op1, SB);
|
| -
|
| // Emulate PCMPGTQ with (hi1 > hi2) | ((hi1 == hi2) & (lo1 > lo2))
|
| SDValue GT = DAG.getNode(X86ISD::PCMPGT, dl, MVT::v4i32, Op0, Op1);
|
| SDValue EQ = DAG.getNode(X86ISD::PCMPEQ, dl, MVT::v4i32, Op0, Op1);
|
| @@ -9498,7 +9496,7 @@ static SDValue LowerVSETCC(SDValue Op, const X86Subtarget *Subtarget,
|
| // pcmpeqd + pshufd + pand.
|
| assert(Subtarget->hasSSE2() && !FlipSigns && "Don't know how to lower!");
|
|
|
| - // First cast everything to the right type.
|
| + // First cast everything to the right type,
|
| Op0 = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, Op0);
|
| Op1 = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, Op1);
|
|
|
| @@ -9517,15 +9515,6 @@ static SDValue LowerVSETCC(SDValue Op, const X86Subtarget *Subtarget,
|
| }
|
| }
|
|
|
| - // Since SSE has no unsigned integer comparisons, we need to flip the sign
|
| - // bits of the inputs before performing those operations.
|
| - if (FlipSigns) {
|
| - EVT EltVT = VT.getVectorElementType();
|
| - SDValue SB = DAG.getConstant(APInt::getSignBit(EltVT.getSizeInBits()), VT);
|
| - Op0 = DAG.getNode(ISD::XOR, dl, VT, Op0, SB);
|
| - Op1 = DAG.getNode(ISD::XOR, dl, VT, Op1, SB);
|
| - }
|
| -
|
| SDValue Result = DAG.getNode(Opc, dl, VT, Op0, Op1);
|
|
|
| // If the logical-not of the result is required, perform that now.
|
|
|