[llvm-commits] [llvm] r46407 - /llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Sat Jan 26 22:09:28 PST 2008


Author: lattner
Date: Sun Jan 27 00:09:28 2008
New Revision: 46407

URL: http://llvm.org/viewvc/llvm-project?rev=46407&view=rev
Log:
For long double constants, print an approximation of their value to the .s file to make it easier to read.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=46407&r1=46406&r2=46407&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Sun Jan 27 00:09:28 2008
@@ -939,10 +939,13 @@
       // 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 @@
        } 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";





More information about the llvm-commits mailing list