diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-11 18:32:33 +0000 |
commit | 3f6eb7419de437436265831fce92f62498556e08 (patch) | |
tree | cb752d4a86ec5c5dd783cfc421e30d0cf7600e87 /lib/CodeGen/AsmPrinter.cpp | |
parent | 6320260e060ce4fc5d199d757b15a0f43be66029 (diff) |
Add APInt interfaces to APFloat (allows directly
access to bits). Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling
(untested, probably does not work).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index e80afd40ee..49bcba7814 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -830,29 +830,31 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) { // FP Constants are printed as integer constants to avoid losing // precision... if (CFP->getType() == Type::DoubleTy) { - double Val = CFP->getValueAPF().convertToDouble(); + double Val = CFP->getValueAPF().convertToDouble(); // for comment only + uint64_t i = *CFP->getValueAPF().convertToAPInt().getRawData(); if (TAI->getData64bitsDirective()) - O << TAI->getData64bitsDirective() << DoubleToBits(Val) << "\t" + O << TAI->getData64bitsDirective() << i << "\t" << TAI->getCommentString() << " double value: " << Val << "\n"; else if (TD->isBigEndian()) { - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val) >> 32) + O << TAI->getData32bitsDirective() << unsigned(i >> 32) << "\t" << TAI->getCommentString() << " double most significant word " << Val << "\n"; - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val)) + O << TAI->getData32bitsDirective() << unsigned(i) << "\t" << TAI->getCommentString() << " double least significant word " << Val << "\n"; } else { - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val)) + O << TAI->getData32bitsDirective() << unsigned(i) << "\t" << TAI->getCommentString() << " double least significant word " << Val << "\n"; - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val) >> 32) + O << TAI->getData32bitsDirective() << unsigned(i >> 32) << "\t" << TAI->getCommentString() << " double most significant word " << Val << "\n"; } return; } else { - float Val = CFP->getValueAPF().convertToFloat(); - O << TAI->getData32bitsDirective() << FloatToBits(Val) + float Val = CFP->getValueAPF().convertToFloat(); // for comment only + O << TAI->getData32bitsDirective() + << (uint32_t)*CFP->getValueAPF().convertToAPInt().getRawData() << "\t" << TAI->getCommentString() << " float " << Val << "\n"; return; } |