diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-27 06:09:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-27 06:09:28 +0000 |
commit | 00d6306a51b2869b40b203d8e060654cf3500918 (patch) | |
tree | b9cb3268b8c8256805af26a43b09d4d782baf0f4 /lib | |
parent | df7e840b3f2e3406191a6e69df3b929305b885ba (diff) | |
download | external_llvm-00d6306a51b2869b40b203d8e060654cf3500918.zip external_llvm-00d6306a51b2869b40b203d8e060654cf3500918.tar.gz external_llvm-00d6306a51b2869b40b203d8e060654cf3500918.tar.bz2 |
For long double constants, print an approximation of their value to the .s file to make it easier to read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index bb66bd2..7c4a8e1 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -939,10 +939,13 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, bool Packed) { // api needed to prevent premature destruction APInt api = CFP->getValueAPF().convertToAPInt(); const uint64_t *p = api.getRawData(); + APFloat DoubleVal = CFP->getValueAPF(); + DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven); if (TD->isBigEndian()) { O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) << "\t" << TAI->getCommentString() - << " long double most significant halfword\n"; + << " long double most significant halfword of ~" + << DoubleVal.convertToDouble() << "\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 32) << "\t" << TAI->getCommentString() << " long double next halfword\n"; @@ -958,7 +961,8 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, bool Packed) { } else { O << TAI->getData16bitsDirective() << uint16_t(p[1]) << "\t" << TAI->getCommentString() - << " long double least significant halfword\n"; + << " long double least significant halfword of ~" + << DoubleVal.convertToDouble() << "\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0]) << "\t" << TAI->getCommentString() << " long double next halfword\n"; |