diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-06 18:13:44 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-06 18:13:44 +0000 |
commit | b9de9f07d611823ea3371b65f87035f482ace2ad (patch) | |
tree | b314e17b0444f33dc3be37eaeaeaa8ea7dd1d17e /lib/Target/X86/X86ISelLowering.cpp | |
parent | 6d2c506cce46d4edcc314ca363b5e4ec4584cc38 (diff) | |
download | external_llvm-b9de9f07d611823ea3371b65f87035f482ace2ad.zip external_llvm-b9de9f07d611823ea3371b65f87035f482ace2ad.tar.gz external_llvm-b9de9f07d611823ea3371b65f87035f482ace2ad.tar.bz2 |
Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 8cfd5f9..22b282b 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -3412,11 +3412,11 @@ SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG &DAG) { const Type *OpNTy = MVT::getTypeForValueType(EltVT); std::vector<Constant*> CV; if (EltVT == MVT::f64) { - Constant *C = ConstantFP::get(OpNTy, BitsToDouble(~(1ULL << 63))); + Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(~(1ULL << 63)))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = ConstantFP::get(OpNTy, BitsToFloat(~(1U << 31))); + Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(~(1U << 31)))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -3440,11 +3440,11 @@ SDOperand X86TargetLowering::LowerFNEG(SDOperand Op, SelectionDAG &DAG) { const Type *OpNTy = MVT::getTypeForValueType(EltVT); std::vector<Constant*> CV; if (EltVT == MVT::f64) { - Constant *C = ConstantFP::get(OpNTy, BitsToDouble(1ULL << 63)); + Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(1ULL << 63))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = ConstantFP::get(OpNTy, BitsToFloat(1U << 31)); + Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(1U << 31))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -3475,18 +3475,19 @@ SDOperand X86TargetLowering::LowerFCOPYSIGN(SDOperand Op, SelectionDAG &DAG) { if (MVT::getSizeInBits(SrcVT) < MVT::getSizeInBits(VT)) { Op1 = DAG.getNode(ISD::FP_EXTEND, VT, Op1); SrcVT = VT; + SrcTy = MVT::getTypeForValueType(SrcVT); } // First get the sign bit of second operand. std::vector<Constant*> CV; if (SrcVT == MVT::f64) { - CV.push_back(ConstantFP::get(SrcTy, BitsToDouble(1ULL << 63))); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); + CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(1ULL << 63)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0))); } else { - CV.push_back(ConstantFP::get(SrcTy, BitsToFloat(1U << 31))); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); + CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(1U << 31)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); } Constant *C = ConstantVector::get(CV); SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4); @@ -3508,13 +3509,13 @@ SDOperand X86TargetLowering::LowerFCOPYSIGN(SDOperand Op, SelectionDAG &DAG) { // Clear first operand sign bit. CV.clear(); if (VT == MVT::f64) { - CV.push_back(ConstantFP::get(SrcTy, BitsToDouble(~(1ULL << 63)))); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); + CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(~(1ULL << 63))))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0))); } else { - CV.push_back(ConstantFP::get(SrcTy, BitsToFloat(~(1U << 31)))); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); - CV.push_back(ConstantFP::get(SrcTy, 0.0)); + CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(~(1U << 31))))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); } C = ConstantVector::get(CV); CPIdx = DAG.getConstantPool(C, getPointerTy(), 4); |