mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-22 10:29:35 +00:00
simplify the code for printing x86 long double, don't do work
for -fverbose-asm unless it's on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93926 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b1bb4afbc7
commit
72b5ebc6be
@ -1200,82 +1200,29 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP,
|
||||
// api needed to prevent premature destruction
|
||||
APInt api = CFP->getValueAPF().bitcastToAPInt();
|
||||
const uint64_t *p = api.getRawData();
|
||||
// Convert to double so we can print the approximate val as a comment.
|
||||
APFloat DoubleVal = CFP->getValueAPF();
|
||||
bool ignored;
|
||||
DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
|
||||
&ignored);
|
||||
if (VerboseAsm) {
|
||||
// Convert to double so we can print the approximate val as a comment.
|
||||
APFloat DoubleVal = CFP->getValueAPF();
|
||||
bool ignored;
|
||||
DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
|
||||
&ignored);
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString() << " x86_fp80 ~= "
|
||||
<< DoubleVal.convertToDouble() << '\n';
|
||||
}
|
||||
|
||||
if (TD.isBigEndian()) {
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " most significant halfword of x86_fp80 ~"
|
||||
<< DoubleVal.convertToDouble();
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString() << " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString() << " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString() << " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " least significant halfword";
|
||||
}
|
||||
O << '\n';
|
||||
} else {
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " least significant halfword of x86_fp80 ~"
|
||||
<< DoubleVal.convertToDouble();
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " next halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
|
||||
if (VerboseAsm) {
|
||||
O.PadToColumn(MAI->getCommentColumn());
|
||||
O << MAI->getCommentString()
|
||||
<< " most significant halfword";
|
||||
}
|
||||
O << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]) <<'\n';
|
||||
} else {
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]) << '\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)<<'\n';
|
||||
O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) << '\n';
|
||||
}
|
||||
OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
|
||||
TD.getTypeStoreSize(CFP->getType()), AddrSpace);
|
||||
|
Loading…
Reference in New Issue
Block a user