Revise previous patch per review comments.

Next round of x87 long double stuff.
Getting close now, basically works.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen
2007-09-12 03:30:33 +00:00
parent 257500db04
commit 9d5f456077
15 changed files with 162 additions and 89 deletions

View File

@@ -629,7 +629,6 @@ bool BitcodeReader::ParseConstants() {
V = ConstantFP::get(CurTy, APFloat(APInt(32, (uint32_t)Record[0])));
else if (CurTy == Type::DoubleTy)
V = ConstantFP::get(CurTy, APFloat(APInt(64, Record[0])));
// FIXME: Make long double constants work. BitsToDouble does not make it.
else if (CurTy == Type::X86_FP80Ty)
V = ConstantFP::get(CurTy, APFloat(APInt(80, 2, &Record[0])));
else if (CurTy == Type::FP128Ty)

View File

@@ -526,11 +526,8 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
Code = bitc::CST_CODE_FLOAT;
const Type *Ty = CFP->getType();
if (Ty == Type::FloatTy)
Record.push_back((uint32_t)*CFP->getValueAPF().convertToAPInt().
getRawData());
else if (Ty == Type::DoubleTy) {
Record.push_back(*CFP->getValueAPF().convertToAPInt().getRawData());
if (Ty == Type::FloatTy || Ty == Type::DoubleTy) {
Record.push_back(CFP->getValueAPF().convertToAPInt().getZExtValue());
} else if (Ty == Type::X86_FP80Ty) {
const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData();
Record.push_back(p[0]);