diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-10-02 09:08:51 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-10-02 09:08:51 +0000 |
commit | ad23f270dbbe8c55f7739118be97272eddd9e9df (patch) | |
tree | ed9a0448c12fea5638e0461953a79e6f91e8a967 /llvm/lib/Target/X86/X86MCInstLower.cpp | |
parent | c066a92657a78f13b5e490e1b51c11d740671de0 (diff) | |
download | bcm5719-llvm-ad23f270dbbe8c55f7739118be97272eddd9e9df.tar.gz bcm5719-llvm-ad23f270dbbe8c55f7739118be97272eddd9e9df.zip |
[X86] Standardize floating point assembly comments
Consistently try to use APFloat::toString for floating point constant comments to get rid of differences between Constant / ConstantDataSequential values - it should help stop some of the linux-windows buildbot failures matching NaN/INF etc. as well.
Differential Revision: https://reviews.llvm.org/D52702
llvm-svn: 343562
Diffstat (limited to 'llvm/lib/Target/X86/X86MCInstLower.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86MCInstLower.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index 921f1530cfc..c97b0669a58 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -1482,6 +1482,12 @@ static std::string getShuffleComment(const MachineInstr *MI, unsigned SrcOp1Idx, return Comment; } +static void printConstant(const APFloat& Flt, raw_ostream &CS) { + SmallString<32> Str; + Flt.toString(Str); + CS << Str; +} + static void printConstant(const Constant *COp, raw_ostream &CS) { if (isa<UndefValue>(COp)) { CS << "u"; @@ -1500,9 +1506,7 @@ static void printConstant(const Constant *COp, raw_ostream &CS) { CS << ")"; } } else if (auto *CF = dyn_cast<ConstantFP>(COp)) { - SmallString<32> Str; - CF->getValueAPF().toString(Str); - CS << Str; + printConstant(CF->getValueAPF(), CS); } else { CS << "?"; } @@ -2097,10 +2101,10 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { CS << ","; if (CDS->getElementType()->isIntegerTy()) CS << CDS->getElementAsInteger(i); - else if (CDS->getElementType()->isFloatTy()) - CS << CDS->getElementAsFloat(i); - else if (CDS->getElementType()->isDoubleTy()) - CS << CDS->getElementAsDouble(i); + else if (CDS->getElementType()->isHalfTy() || + CDS->getElementType()->isFloatTy() || + CDS->getElementType()->isDoubleTy()) + printConstant(CDS->getElementAsAPFloat(i), CS); else CS << "?"; } |