mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
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
This commit is contained in:
@ -527,13 +527,20 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
|
||||
Code = bitc::CST_CODE_FLOAT;
|
||||
const Type *Ty = CFP->getType();
|
||||
if (Ty == Type::FloatTy)
|
||||
Record.push_back(FloatToBits(CFP->getValueAPF().convertToFloat()));
|
||||
Record.push_back((uint32_t)*CFP->getValueAPF().convertToAPInt().
|
||||
getRawData());
|
||||
else if (Ty == Type::DoubleTy) {
|
||||
Record.push_back(DoubleToBits(CFP->getValueAPF().convertToDouble()));
|
||||
// FIXME: make long double constants work.
|
||||
} else if (Ty == Type::X86_FP80Ty ||
|
||||
Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {
|
||||
assert (0 && "Long double constants not handled yet.");
|
||||
Record.push_back(*CFP->getValueAPF().convertToAPInt().getRawData());
|
||||
} else if (Ty == Type::X86_FP80Ty) {
|
||||
const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData();
|
||||
Record.push_back(p[0]);
|
||||
Record.push_back((uint16_t)p[1]);
|
||||
} else if (Ty == Type::FP128Ty) {
|
||||
const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData();
|
||||
Record.push_back(p[0]);
|
||||
Record.push_back(p[1]);
|
||||
} else if (Ty == Type::PPC_FP128Ty) {
|
||||
assert(0 && "PowerPC long double constants not handled yet.");
|
||||
} else {
|
||||
assert (0 && "Unknown FP type!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user