Add APInt interfaces to APFloat (allows directly
access to bits). Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling
(untested, probably does not work).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 8715f89..0642993 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -622,23 +622,24 @@
NumWords, &Words[0]));
break;
}
- case bitc::CST_CODE_FLOAT: // FLOAT: [fpval]
+ case bitc::CST_CODE_FLOAT: { // FLOAT: [fpval]
if (Record.empty())
return Error("Invalid FLOAT record");
if (CurTy == Type::FloatTy)
- V = ConstantFP::get(CurTy, APFloat(BitsToFloat(Record[0])));
+ V = ConstantFP::get(CurTy, APFloat(APInt(32, (uint32_t)Record[0])));
else if (CurTy == Type::DoubleTy)
- V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
+ 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(BitsToDouble(Record[0])));
+ V = ConstantFP::get(CurTy, APFloat(APInt(80, 2, &Record[0])));
else if (CurTy == Type::FP128Ty)
- V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0])));
+ V = ConstantFP::get(CurTy, APFloat(APInt(128, 2, &Record[0])));
else if (CurTy == Type::PPC_FP128Ty)
assert(0 && "PowerPC long double constants not handled yet.");
else
V = UndefValue::get(CurTy);
break;
+ }
case bitc::CST_CODE_AGGREGATE: {// AGGREGATE: [n x value number]
if (Record.empty())