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 | f1a6c9fe86e14e67d202f7dcb76e9cbd22cb1e60 (patch) | |
tree | 635ec9c88ae057ea5af385e568e0d5adca63f338 /llvm/lib/CodeGen/AsmPrinter.cpp | |
parent | fa1e7eef303cc273021de9b1c2eb6853741312f4 (diff) | |
download | bcm5719-llvm-f1a6c9fe86e14e67d202f7dcb76e9cbd22cb1e60.tar.gz bcm5719-llvm-f1a6c9fe86e14e67d202f7dcb76e9cbd22cb1e60.zip |
For long double constants, print an approximation of their value to the .s file to make it easier to read.
llvm-svn: 46407
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index bb66bd2ad5c..7c4a8e189dc 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/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"; |