[llvm-commits] [llvm] r67599 - in /llvm/branches/Apple/Dib: lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/AsmPrinter/ lib/Support/ lib/Target/ARM/AsmPrinter/ lib/Target/CBackend/ lib/Target/PowerPC/AsmPrinter/ lib/Target/X86/AsmPrinter/ lib/VMCore/ test/CodeGen/X86/
Bill Wendling
isanbard at gmail.com
Mon Mar 23 18:59:47 PDT 2009
Author: void
Date: Mon Mar 23 20:59:46 2009
New Revision: 67599
URL: http://llvm.org/viewvc/llvm-project?rev=67599&view=rev
Log:
--- Merging (from foreign repository) r67562 into '.':
A test/CodeGen/X86/2009-03-23-i80-fp80.ll
U lib/CodeGen/AsmPrinter/AsmPrinter.cpp
U lib/Target/CBackend/CBackend.cpp
U lib/Bitcode/Reader/BitcodeReader.cpp
U lib/Bitcode/Writer/BitcodeWriter.cpp
U lib/VMCore/AsmWriter.cpp
U lib/Support/APFloat.cpp
U lib/AsmParser/LLLexer.cpp
U lib/AsmParser/LLLexer.h
--- Merging (from foreign repository) r67580 into '.':
G lib/CodeGen/AsmPrinter/AsmPrinter.cpp
U lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
U lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
U lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
Added:
llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-23-i80-fp80.ll
Modified:
llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.cpp
llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.h
llvm/branches/Apple/Dib/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/branches/Apple/Dib/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/branches/Apple/Dib/lib/Support/APFloat.cpp
llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/branches/Apple/Dib/lib/Target/CBackend/CBackend.cpp
llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
llvm/branches/Apple/Dib/lib/VMCore/AsmWriter.cpp
Modified: llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.cpp Mon Mar 23 20:59:46 2009
@@ -115,6 +115,37 @@
Error("constant bigger than 128 bits detected!");
}
+/// FP80HexToIntPair - translate an 80 bit FP80 number (20 hexits) into
+/// { low64, high16 } as usual for an APInt.
+void LLLexer::FP80HexToIntPair(const char *Buffer, const char *End,
+ uint64_t Pair[2]) {
+ Pair[1] = 0;
+ for (int i=0; i<4 && Buffer != End; i++, Buffer++) {
+ assert(Buffer != End);
+ Pair[1] *= 16;
+ char C = *Buffer;
+ if (C >= '0' && C <= '9')
+ Pair[1] += C-'0';
+ else if (C >= 'A' && C <= 'F')
+ Pair[1] += C-'A'+10;
+ else if (C >= 'a' && C <= 'f')
+ Pair[1] += C-'a'+10;
+ }
+ Pair[0] = 0;
+ for (int i=0; i<16; i++, Buffer++) {
+ Pair[0] *= 16;
+ char C = *Buffer;
+ if (C >= '0' && C <= '9')
+ Pair[0] += C-'0';
+ else if (C >= 'A' && C <= 'F')
+ Pair[0] += C-'A'+10;
+ else if (C >= 'a' && C <= 'f')
+ Pair[0] += C-'a'+10;
+ }
+ if (Buffer != End)
+ Error("constant bigger than 128 bits detected!");
+}
+
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
// appropriate character.
static void UnEscapeLexed(std::string &Str) {
@@ -670,19 +701,21 @@
}
uint64_t Pair[2];
- HexToIntPair(TokStart+3, CurPtr, Pair);
switch (Kind) {
default: assert(0 && "Unknown kind!");
case 'K':
// F80HexFPConstant - x87 long double in hexadecimal format (10 bytes)
+ FP80HexToIntPair(TokStart+3, CurPtr, Pair);
APFloatVal = APFloat(APInt(80, 2, Pair));
return lltok::APFloat;
case 'L':
// F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes)
+ HexToIntPair(TokStart+3, CurPtr, Pair);
APFloatVal = APFloat(APInt(128, 2, Pair), true);
return lltok::APFloat;
case 'M':
// PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes)
+ HexToIntPair(TokStart+3, CurPtr, Pair);
APFloatVal = APFloat(APInt(128, 2, Pair));
return lltok::APFloat;
}
Modified: llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.h?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.h (original)
+++ llvm/branches/Apple/Dib/lib/AsmParser/LLLexer.h Mon Mar 23 20:59:46 2009
@@ -77,6 +77,7 @@
uint64_t atoull(const char *Buffer, const char *End);
uint64_t HexIntToVal(const char *Buffer, const char *End);
void HexToIntPair(const char *Buffer, const char *End, uint64_t Pair[2]);
+ void FP80HexToIntPair(const char *Buff, const char *End, uint64_t Pair[2]);
};
} // end namespace llvm
Modified: llvm/branches/Apple/Dib/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Bitcode/Reader/BitcodeReader.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Bitcode/Reader/BitcodeReader.cpp Mon Mar 23 20:59:46 2009
@@ -801,9 +801,13 @@
V = ConstantFP::get(APFloat(APInt(32, (uint32_t)Record[0])));
else if (CurTy == Type::DoubleTy)
V = ConstantFP::get(APFloat(APInt(64, Record[0])));
- else if (CurTy == Type::X86_FP80Ty)
- V = ConstantFP::get(APFloat(APInt(80, 2, &Record[0])));
- else if (CurTy == Type::FP128Ty)
+ else if (CurTy == Type::X86_FP80Ty) {
+ // Bits are not stored the same way as a normal i80 APInt, compensate.
+ uint64_t Rearrange[2];
+ Rearrange[0] = (Record[1] & 0xffffLL) | (Record[0] << 16);
+ Rearrange[1] = Record[0] >> 48;
+ V = ConstantFP::get(APFloat(APInt(80, 2, Rearrange)));
+ } else if (CurTy == Type::FP128Ty)
V = ConstantFP::get(APFloat(APInt(128, 2, &Record[0]), true));
else if (CurTy == Type::PPC_FP128Ty)
V = ConstantFP::get(APFloat(APInt(128, 2, &Record[0])));
Modified: llvm/branches/Apple/Dib/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Mar 23 20:59:46 2009
@@ -559,10 +559,11 @@
Record.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
} else if (Ty == Type::X86_FP80Ty) {
// api needed to prevent premature destruction
+ // bits are not in the same order as a normal i80 APInt, compensate.
APInt api = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
- Record.push_back(p[0]);
- Record.push_back((uint16_t)p[1]);
+ Record.push_back((p[1] << 48) | (p[0] >> 16));
+ Record.push_back(p[0] & 0xffffLL);
} else if (Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {
APInt api = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Mar 23 20:59:46 2009
@@ -1010,30 +1010,42 @@
if (CFP->getType() == Type::DoubleTy) {
double Val = CFP->getValueAPF().convertToDouble(); // for comment only
uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
- if (TAI->getData64bitsDirective(AddrSpace))
- O << TAI->getData64bitsDirective(AddrSpace) << i << '\t'
- << TAI->getCommentString() << " double value: " << Val << '\n';
- else if (TD->isBigEndian()) {
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32)
- << '\t' << TAI->getCommentString()
- << " double most significant word " << Val << '\n';
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i)
- << '\t' << TAI->getCommentString()
- << " double least significant word " << Val << '\n';
+ if (TAI->getData64bitsDirective(AddrSpace)) {
+ O << TAI->getData64bitsDirective(AddrSpace) << i;
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " double value: " << Val;
+ O << '\n';
+ } else if (TD->isBigEndian()) {
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " double most significant word " << Val;
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " double least significant word " << Val;
+ O << '\n';
} else {
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i)
- << '\t' << TAI->getCommentString()
- << " double least significant word " << Val << '\n';
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32)
- << '\t' << TAI->getCommentString()
- << " double most significant word " << Val << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " double least significant word " << Val;
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " double most significant word " << Val;
+ O << '\n';
}
return;
} else if (CFP->getType() == Type::FloatTy) {
float Val = CFP->getValueAPF().convertToFloat(); // for comment only
O << TAI->getData32bitsDirective(AddrSpace)
- << CFP->getValueAPF().bitcastToAPInt().getZExtValue()
- << '\t' << TAI->getCommentString() << " float " << Val << '\n';
+ << CFP->getValueAPF().bitcastToAPInt().getZExtValue();
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " float " << Val;
+ O << '\n';
return;
} else if (CFP->getType() == Type::X86_FP80Ty) {
// all long double variants are printed as hex
@@ -1046,39 +1058,56 @@
DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
&ignored);
if (TD->isBigEndian()) {
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)
- << '\t' << TAI->getCommentString()
- << " long double most significant halfword of ~"
- << DoubleVal.convertToDouble() << '\n';
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0])
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1])
- << '\t' << TAI->getCommentString()
- << " long double least significant halfword\n";
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double most significant halfword of ~"
+ << DoubleVal.convertToDouble();
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double least significant halfword";
+ O << '\n';
} else {
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1])
- << '\t' << TAI->getCommentString()
- << " long double least significant halfword of ~"
- << DoubleVal.convertToDouble() << '\n';
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0])
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double next halfword\n";
- O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)
- << '\t' << TAI->getCommentString()
- << " long double most significant halfword\n";
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double least significant halfword of ~"
+ << DoubleVal.convertToDouble();
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next halfword";
+ O << '\n';
+ O << TAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double most significant halfword";
+ O << '\n';
}
EmitZeros(TD->getTypePaddedSize(Type::X86_FP80Ty) -
TD->getTypeStoreSize(Type::X86_FP80Ty), AddrSpace);
@@ -1089,31 +1118,47 @@
APInt api = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
if (TD->isBigEndian()) {
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double most significant word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0])
- << '\t' << TAI->getCommentString()
- << " long double next word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double next word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1])
- << '\t' << TAI->getCommentString()
- << " long double least significant word\n";
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double most significant word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double least significant word";
+ O << '\n';
} else {
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1])
- << '\t' << TAI->getCommentString()
- << " long double least significant word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double next word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0])
- << '\t' << TAI->getCommentString()
- << " long double next word\n";
- O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32)
- << '\t' << TAI->getCommentString()
- << " long double most significant word\n";
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double least significant word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0]);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double next word";
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " long double most significant word";
+ O << '\n';
}
return;
} else assert(0 && "Floating point constant type not handled");
@@ -1140,19 +1185,27 @@
if (TAI->getData64bitsDirective(AddrSpace))
O << TAI->getData64bitsDirective(AddrSpace) << Val << '\n';
else if (TD->isBigEndian()) {
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32)
- << '\t' << TAI->getCommentString()
- << " Double-word most significant word " << Val << '\n';
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val)
- << '\t' << TAI->getCommentString()
- << " Double-word least significant word " << Val << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " Double-word most significant word " << Val;
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " Double-word least significant word " << Val;
+ O << '\n';
} else {
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val)
- << '\t' << TAI->getCommentString()
- << " Double-word least significant word " << Val << '\n';
- O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32)
- << '\t' << TAI->getCommentString()
- << " Double-word most significant word " << Val << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " Double-word least significant word " << Val;
+ O << '\n';
+ O << TAI->getData32bitsDirective(AddrSpace) << unsigned(Val >> 32);
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString()
+ << " Double-word most significant word " << Val;
+ O << '\n';
}
}
}
@@ -1188,10 +1241,12 @@
printDataDirective(type, AddrSpace);
EmitConstantValueOnly(CV);
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
- SmallString<40> S;
- CI->getValue().toStringUnsigned(S, 16);
- O << "\t\t\t" << TAI->getCommentString() << " 0x" << S.c_str();
+ if (VerboseAsm) {
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
+ SmallString<40> S;
+ CI->getValue().toStringUnsigned(S, 16);
+ O << "\t\t\t" << TAI->getCommentString() << " 0x" << S.c_str();
+ }
}
O << '\n';
}
@@ -1211,7 +1266,8 @@
if (!strcmp(Code, "private")) {
O << TAI->getPrivateGlobalPrefix();
} else if (!strcmp(Code, "comment")) {
- O << TAI->getCommentString();
+ if (VerboseAsm)
+ O << TAI->getCommentString();
} else if (!strcmp(Code, "uid")) {
// Assign a unique ID to this machine instruction.
static const MachineInstr *LastMI = 0;
@@ -1441,8 +1497,9 @@
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
void AsmPrinter::printImplicitDef(const MachineInstr *MI) const {
- O << '\t' << TAI->getCommentString() << " implicit-def: "
- << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n';
+ if (VerboseAsm)
+ O << '\t' << TAI->getCommentString() << " implicit-def: "
+ << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n';
}
/// printLabel - This method prints a local label used by debug and
Modified: llvm/branches/Apple/Dib/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Support/APFloat.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Support/APFloat.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Support/APFloat.cpp Mon Mar 23 20:59:46 2009
@@ -2603,10 +2603,9 @@
}
uint64_t words[2];
- words[0] = ((uint64_t)(sign & 1) << 63) |
- ((myexponent & 0x7fffLL) << 48) |
- ((mysignificand >>16) & 0xffffffffffffLL);
- words[1] = mysignificand & 0xffff;
+ words[0] = mysignificand;
+ words[1] = ((uint64_t)(sign & 1) << 15) |
+ (myexponent & 0x7fffLL);
return APInt(80, 2, words);
}
@@ -2764,14 +2763,13 @@
assert(api.getBitWidth()==80);
uint64_t i1 = api.getRawData()[0];
uint64_t i2 = api.getRawData()[1];
- uint64_t myexponent = (i1 >> 48) & 0x7fff;
- uint64_t mysignificand = ((i1 << 16) & 0xffffffffffff0000ULL) |
- (i2 & 0xffff);
+ uint64_t myexponent = (i2 & 0x7fff);
+ uint64_t mysignificand = i1;
initialize(&APFloat::x87DoubleExtended);
assert(partCount()==2);
- sign = static_cast<unsigned int>(i1>>63);
+ sign = static_cast<unsigned int>(i2>>15);
if (myexponent==0 && mysignificand==0) {
// exponent, significand meaningless
category = fcZero;
Modified: llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Mon Mar 23 20:59:46 2009
@@ -255,7 +255,7 @@
I != E; ++I) {
// Print a label for the basic block.
if (I != MF.begin()) {
- printBasicBlockLabel(I, true, true);
+ printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
@@ -356,7 +356,9 @@
if (Rot) {
O << "#" << Imm << ", " << Rot;
// Pretty printed version.
- O << ' ' << TAI->getCommentString() << ' ' << (int)ARM_AM::rotr32(Imm, Rot);
+ if (VerboseAsm)
+ O << ' ' << TAI->getCommentString()
+ << ' ' << (int)ARM_AM::rotr32(Imm, Rot);
} else {
O << "#" << Imm;
}
@@ -870,8 +872,11 @@
O << "\t.globl " << name << '\n'
<< TAI->getWeakDefDirective() << name << '\n';
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << ' ';
- PrintUnmangledNameSafely(GVar, O);
+ O << name << ":";
+ if (VerboseAsm) {
+ O << "\t\t\t\t" << TAI->getCommentString() << ' ';
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << '\n';
EmitGlobalConstant(C);
return;
@@ -892,8 +897,10 @@
if (TAI->getCOMMDirectiveTakesAlignment())
O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
- O << "\t\t" << TAI->getCommentString() << " ";
- PrintUnmangledNameSafely(GVar, O);
+ if (VerboseAsm) {
+ O << "\t\t" << TAI->getCommentString() << " ";
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << "\n";
return;
}
@@ -928,8 +935,11 @@
}
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " ";
- PrintUnmangledNameSafely(GVar, O);
+ O << name << ":";
+ if (VerboseAsm) {
+ O << "\t\t\t\t" << TAI->getCommentString() << " ";
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << "\n";
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size " << name << ", " << Size << "\n";
Modified: llvm/branches/Apple/Dib/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CBackend/CBackend.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/CBackend/CBackend.cpp Mon Mar 23 20:59:46 2009
@@ -2087,9 +2087,8 @@
APInt api = FPC->getValueAPF().bitcastToAPInt();
const uint64_t *p = api.getRawData();
Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
- << " = { 0x"
- << utohexstr((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16)
- << "ULL, 0x" << utohexstr((uint16_t)(p[0] >> 48)) << ",{0,0,0}"
+ << " = { 0x" << utohexstr(p[0])
+ << "ULL, 0x" << utohexstr((uint16_t)p[1]) << ",{0,0,0}"
<< "}; /* Long double constant */\n";
} else if (FPC->getType() == Type::PPC_FP128Ty) {
APInt api = FPC->getValueAPF().bitcastToAPInt();
Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Mon Mar 23 20:59:46 2009
@@ -704,9 +704,12 @@
} else {
O << ".comm " << name << ',' << Size;
}
- O << "\t\t" << TAI->getCommentString() << " '";
- PrintUnmangledNameSafely(GVar, O);
- O << "'\n";
+ if (VerboseAsm) {
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(GVar, O);
+ O << "'";
+ }
+ O << '\n';
return;
}
@@ -737,9 +740,13 @@
}
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
- PrintUnmangledNameSafely(GVar, O);
- O << "'\n";
+ O << name << ":";
+ if (VerboseAsm) {
+ O << "\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(GVar, O);
+ O << "'";
+ }
+ O << '\n';
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!
@@ -819,7 +826,7 @@
I != E; ++I) {
// Print a label for the basic block.
if (I != MF.begin()) {
- printBasicBlockLabel(I, true, true);
+ printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
@@ -938,8 +945,11 @@
O << "\t.globl " << name << '\n'
<< TAI->getWeakDefDirective() << name << '\n';
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " ";
- PrintUnmangledNameSafely(GVar, O);
+ O << name << ":";
+ if (VerboseAsm) {
+ O << "\t\t\t\t" << TAI->getCommentString() << " ";
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << '\n';
EmitGlobalConstant(C);
return;
@@ -949,9 +959,12 @@
if (Subtarget.isDarwin9())
O << ',' << Align;
}
- O << "\t\t" << TAI->getCommentString() << " '";
- PrintUnmangledNameSafely(GVar, O);
- O << "'\n";
+ if (VerboseAsm) {
+ O << "\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(GVar, O);
+ O << "'";
+ }
+ O << '\n';
return;
}
@@ -980,9 +993,13 @@
}
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << " '";
- PrintUnmangledNameSafely(GVar, O);
- O << "'\n";
+ O << name << ":";
+ if (VerboseAsm) {
+ O << "\t\t\t\t" << TAI->getCommentString() << " '";
+ PrintUnmangledNameSafely(GVar, O);
+ O << "'";
+ }
+ O << '\n';
// If the initializer is a extern weak symbol, remember to emit the weak
// reference!
Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Mar 23 20:59:46 2009
@@ -239,7 +239,7 @@
I != E; ++I) {
// Print a label for the basic block.
if (!I->pred_empty()) {
- printBasicBlockLabel(I, true, true);
+ printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
@@ -315,7 +315,7 @@
O << MO.getImm();
return;
case MachineOperand::MO_MachineBasicBlock:
- printBasicBlockLabel(MO.getMBB());
+ printBasicBlockLabel(MO.getMBB(), false, false, VerboseAsm);
return;
case MachineOperand::MO_JumpTableIndex: {
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
@@ -829,8 +829,11 @@
O << "\t.globl " << name << '\n'
<< TAI->getWeakDefDirective() << name << '\n';
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << ' ';
- PrintUnmangledNameSafely(GVar, O);
+ O << name << ":";
+ if (VerboseAsm) {
+ O << name << "\t\t\t\t" << TAI->getCommentString() << ' ';
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << '\n';
EmitGlobalConstant(C);
return;
@@ -848,8 +851,10 @@
if (TAI->getCOMMDirectiveTakesAlignment())
O << ',' << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
- O << "\t\t" << TAI->getCommentString() << ' ';
- PrintUnmangledNameSafely(GVar, O);
+ if (VerboseAsm) {
+ O << "\t\t" << TAI->getCommentString() << ' ';
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << '\n';
return;
}
@@ -887,8 +892,11 @@
}
EmitAlignment(Align, GVar);
- O << name << ":\t\t\t\t" << TAI->getCommentString() << ' ';
- PrintUnmangledNameSafely(GVar, O);
+ O << name << ":";
+ if (VerboseAsm){
+ O << name << "\t\t\t\t" << TAI->getCommentString() << ' ';
+ PrintUnmangledNameSafely(GVar, O);
+ }
O << '\n';
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size\t" << name << ", " << Size << '\n';
Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Mon Mar 23 20:59:46 2009
@@ -489,8 +489,11 @@
if (!bCustomSegment)
EmitAlignment(Align, I);
- O << name << ":\t\t\t\t" << TAI->getCommentString()
- << " " << I->getName() << '\n';
+ O << name << ":";
+ if (VerboseAsm)
+ O << name << "\t\t\t\t" << TAI->getCommentString()
+ << " " << I->getName();
+ O << '\n';
EmitGlobalConstant(C);
Modified: llvm/branches/Apple/Dib/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/VMCore/AsmWriter.cpp?rev=67599&r1=67598&r2=67599&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/VMCore/AsmWriter.cpp Mon Mar 23 20:59:46 2009
@@ -797,9 +797,29 @@
// Some form of long double. These appear as a magic letter identifying
// the type, then a fixed number of hex digits.
Out << "0x";
- if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended)
+ if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended) {
Out << 'K';
- else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad)
+ // api needed to prevent premature destruction
+ APInt api = CFP->getValueAPF().bitcastToAPInt();
+ const uint64_t* p = api.getRawData();
+ uint64_t word = p[1];
+ int shiftcount=12;
+ int width = api.getBitWidth();
+ for (int j=0; j<width; j+=4, shiftcount-=4) {
+ unsigned int nibble = (word>>shiftcount) & 15;
+ if (nibble < 10)
+ Out << (unsigned char)(nibble + '0');
+ else
+ Out << (unsigned char)(nibble - 10 + 'A');
+ if (shiftcount == 0 && j+4 < width) {
+ word = *p;
+ shiftcount = 64;
+ if (width-j-4 < 64)
+ shiftcount = width-j-4;
+ }
+ }
+ return;
+ } else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad)
Out << 'L';
else if (&CFP->getValueAPF().getSemantics() == &APFloat::PPCDoubleDouble)
Out << 'M';
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-23-i80-fp80.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-23-i80-fp80.ll?rev=67599&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-23-i80-fp80.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-03-23-i80-fp80.ll Mon Mar 23 20:59:46 2009
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 302245289961712575840256
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep K40018000000000000000
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin9"
+
+define i80 @from() {
+ %tmp = bitcast x86_fp80 0xK4000C000000000000000 to i80
+ ret i80 %tmp
+}
+
+define x86_fp80 @to() {
+ %tmp = bitcast i80 302259125019767858003968 to x86_fp80
+ ret x86_fp80 %tmp
+}
More information about the llvm-commits
mailing list