mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Make APFloat constructor require explicit semantics.
Previously we tried to infer it from the bit width size, with an added IsIEEE argument for the PPC/IEEE 128-bit case, which had a default value. This default value allowed bugs to creep in, where it was inappropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -986,21 +986,27 @@ bool BitcodeReader::ParseConstants() {
|
||||
if (Record.empty())
|
||||
return Error("Invalid FLOAT record");
|
||||
if (CurTy->isHalfTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(16, (uint16_t)Record[0])));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::IEEEhalf,
|
||||
APInt(16, (uint16_t)Record[0])));
|
||||
else if (CurTy->isFloatTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(32, (uint32_t)Record[0])));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::IEEEsingle,
|
||||
APInt(32, (uint32_t)Record[0])));
|
||||
else if (CurTy->isDoubleTy())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(64, Record[0])));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::IEEEdouble,
|
||||
APInt(64, Record[0])));
|
||||
else if (CurTy->isX86_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(Context, APFloat(APInt(80, Rearrange)));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::x87DoubleExtended,
|
||||
APInt(80, Rearrange)));
|
||||
} else if (CurTy->isFP128Ty())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(128, Record), true));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::IEEEquad,
|
||||
APInt(128, Record)));
|
||||
else if (CurTy->isPPC_FP128Ty())
|
||||
V = ConstantFP::get(Context, APFloat(APInt(128, Record)));
|
||||
V = ConstantFP::get(Context, APFloat(APFloat::PPCDoubleDouble,
|
||||
APInt(128, Record)));
|
||||
else
|
||||
V = UndefValue::get(CurTy);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user