diff options
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index fa6f5691fc..e80afd40ee 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -829,8 +829,8 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) { // FP Constants are printed as integer constants to avoid losing // precision... - double Val = CFP->getValue(); if (CFP->getType() == Type::DoubleTy) { + double Val = CFP->getValueAPF().convertToDouble(); if (TAI->getData64bitsDirective()) O << TAI->getData64bitsDirective() << DoubleToBits(Val) << "\t" << TAI->getCommentString() << " double value: " << Val << "\n"; @@ -851,6 +851,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { } return; } else { + float Val = CFP->getValueAPF().convertToFloat(); O << TAI->getData32bitsDirective() << FloatToBits(Val) << "\t" << TAI->getCommentString() << " float " << Val << "\n"; return; |