Use the new convertFromAPInt instead of convertFromZeroExtendedInteger,
authorDan Gohman <gohman@apple.com>
Fri, 29 Feb 2008 01:44:25 +0000 (01:44 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 29 Feb 2008 01:44:25 +0000 (01:44 +0000)
which allows more of the surrounding arithmetic to be done with APInt
instead of uint64_t.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47745 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 37dab7d7c165933949376122779a01210c2a82c2..2acb1e36684bcc0f91497bb3dd2e230337755a27 100644 (file)
@@ -3754,12 +3754,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
           SDOperand True, False;
           MVT::ValueType VT =  Node->getOperand(0).getValueType();
           MVT::ValueType NVT = Node->getValueType(0);
-          unsigned ShiftAmt = MVT::getSizeInBits(NVT)-1;
           const uint64_t zero[] = {0, 0};
           APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero));
-          uint64_t x = 1ULL << ShiftAmt;
-          (void)apf.convertFromZeroExtendedInteger
-            (&x, MVT::getSizeInBits(NVT), false, APFloat::rmNearestTiesToEven);
+          APInt x = APInt::getSignBit(MVT::getSizeInBits(NVT));
+          (void)apf.convertFromAPInt(x, false, APFloat::rmNearestTiesToEven);
           Tmp2 = DAG.getConstantFP(apf, VT);
           Tmp3 = DAG.getSetCC(TLI.getSetCCResultTy(),
                             Node->getOperand(0), Tmp2, ISD::SETLT);
@@ -3768,7 +3766,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
                               DAG.getNode(ISD::FSUB, VT, Node->getOperand(0),
                                           Tmp2));
           False = DAG.getNode(ISD::XOR, NVT, False, 
-                              DAG.getConstant(1ULL << ShiftAmt, NVT));
+                              DAG.getConstant(x, NVT));
           Result = DAG.getNode(ISD::SELECT, NVT, Tmp3, True, False);
           break;
         } else {