For long double constants, print an approximation of their value to the .s file to...
authorChris Lattner <sabre@nondot.org>
Sun, 27 Jan 2008 06:09:28 +0000 (06:09 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 27 Jan 2008 06:09:28 +0000 (06:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp

index bb66bd2ad5c3b0dbd3abce94d53ec5858c54785b..7c4a8e189dc722ebafa59ef3db7b2bd884376ac6 100644 (file)
@@ -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";