From 3f6eb7419de437436265831fce92f62498556e08 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Tue, 11 Sep 2007 18:32:33 +0000 Subject: 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 --- lib/Bitcode/Reader/BitcodeReader.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 8715f89c25..06429931db 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -622,23 +622,24 @@ bool BitcodeReader::ParseConstants() { 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()) -- cgit v1.2.3-18-g5258