aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.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/Writer/BitcodeWriter.cpp
parenta07765b8f4d9da2836d8f89b26d7f476715dffb4 (diff)
downloadllvm-bed9dc423ceadd08500869cf03e4c0819145d48b.zip
llvm-bed9dc423ceadd08500869cf03e4c0819145d48b.tar.gz
llvm-bed9dc423ceadd08500869cf03e4c0819145d48b.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.) llvm-svn: 41747
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 17c14f0..ab3d983 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -527,9 +527,10 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
Code = bitc::CST_CODE_FLOAT;
const Type *Ty = CFP->getType();
if (Ty == Type::FloatTy) {
- Record.push_back(FloatToBits((float)CFP->getValue()));
+ Record.push_back(DoubleToBits((double)CFP->getValueAPF().
+ convertToFloat()));
} else if (Ty == Type::DoubleTy) {
- Record.push_back(DoubleToBits((double)CFP->getValue()));
+ Record.push_back(DoubleToBits(CFP->getValueAPF().convertToDouble()));
// FIXME: make long double constants work.
} else if (Ty == Type::X86_FP80Ty ||
Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {