From: Dan Gohman Date: Fri, 29 Feb 2008 01:44:25 +0000 (+0000) Subject: Use the new convertFromAPInt instead of convertFromZeroExtendedInteger, X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c7773bf90ee4398ccdeb847db6330cf4507b832b;p=oota-llvm.git Use the new convertFromAPInt instead of convertFromZeroExtendedInteger, 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 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 37dab7d7c16..2acb1e36684 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -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 {