summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-09-06 18:13:44 +0000
committerDale Johannesen <dalej@apple.com>2007-09-06 18:13:44 +0000
commitbed9dc423ceadd08500869cf03e4c0819145d48b (patch)
tree1f39c25a045eca2e6d11262ae1be517e661d4010 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parenta07765b8f4d9da2836d8f89b26d7f476715dffb4 (diff)
downloadbcm5719-llvm-bed9dc423ceadd08500869cf03e4c0819145d48b.tar.gz
bcm5719-llvm-bed9dc423ceadd08500869cf03e4c0819145d48b.zip
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.) llvm-svn: 41747
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 6ad1fd595b7..fcf2e510f9b 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -626,13 +626,16 @@ bool BitcodeReader::ParseConstants() {
if (Record.empty())
return Error("Invalid FLOAT record");
if (CurTy == Type::FloatTy)
- V = ConstantFP::get(CurTy, BitsToFloat(Record[0]));
+ V = ConstantFP::get(CurTy, APFloat((float)BitsToDouble(Record[0])));
else if (CurTy == Type::DoubleTy)
- V = ConstantFP::get(CurTy, BitsToDouble(Record[0]));
- // FIXME: Make long double constants work.
- else if (CurTy == Type::X86_FP80Ty ||
- CurTy == Type::FP128Ty || CurTy == Type::PPC_FP128Ty)
- assert(0 && "Long double constants not handled yet.");
+ V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
+ // FIXME: Make long double constants work. BitsToDouble does not make it.
+ else if (CurTy == Type::X86_FP80Ty)
+ V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
+ else if (CurTy == Type::FP128Ty)
+ V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
+ else if (CurTy == Type::PPC_FP128Ty)
+ assert(0 && "PowerPC long double constants not handled yet.");
else
V = UndefValue::get(CurTy);
break;
OpenPOWER on IntegriCloud