Use `APInt` to convert a 32-bit or 64-bit immediate to an `APFloat` rather than
`bit_cast` to a `float` or `double` to avoid going through host floating-point and
potentially changing the bit pattern of NaNs.
Differential Revision: https://reviews.llvm.org/D97490
} else if (Op.isImm()) {
O << Op.getImm();
} else if (Op.isSFPImm()) {
- O << ::toString(APFloat(bit_cast<float>(Op.getSFPImm())));
+ O << ::toString(APFloat(APFloat::IEEEsingle(), APInt(32, Op.getSFPImm())));
} else if (Op.isDFPImm()) {
- O << ::toString(APFloat(bit_cast<double>(Op.getDFPImm())));
+ O << ::toString(APFloat(APFloat::IEEEdouble(), APInt(64, Op.getDFPImm())));
} else {
assert(Op.isExpr() && "unknown operand kind in printOperand");
// call_indirect instructions have a TYPEINDEX operand that we print