[ARM][WebAssembly] Fix incorrect MCOperand::createDFPImm after D96091

This commit is contained in:
Fangrui Song 2021-02-04 20:39:52 -08:00
parent 6b280ce34c
commit e5269da979
2 changed files with 3 additions and 2 deletions

View File

@ -110,7 +110,7 @@ bool ARMAsmPrinter::lowerOperand(const MachineOperand &MO,
APFloat Val = MO.getFPImm()->getValueAPF();
bool ignored;
Val.convert(APFloat::IEEEdouble(), APFloat::rmTowardZero, &ignored);
MCOp = MCOperand::createDFPImm(Val.convertToDouble());
MCOp = MCOperand::createDFPImm(bit_cast<uint64_t>(Val.convertToDouble()));
break;
}
case MachineOperand::MO_RegisterMask:

View File

@ -114,7 +114,8 @@ bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
Bytes.data() + Size);
Size += sizeof(T);
if (std::is_floating_point<T>::value) {
MI.addOperand(MCOperand::createDFPImm(static_cast<double>(Val)));
MI.addOperand(
MCOperand::createDFPImm(bit_cast<uint64_t>(static_cast<double>(Val))));
} else {
MI.addOperand(MCOperand::createImm(static_cast<int64_t>(Val)));
}