[PATCH] D97490: [WebAssembly] Avoid `bit_cast` when printing f32 and f64 immediates

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 14:19:51 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc62dabc3f501: [WebAssembly] Avoid `bit_cast` when printing f32 and f64 immediates (authored by sunfish).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97490/new/

https://reviews.llvm.org/D97490

Files:
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp


Index: llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
+++ llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp
@@ -281,9 +281,9 @@
   } 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97490.326800.patch
Type: text/x-patch
Size: 865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210226/da60488a/attachment.bin>


More information about the llvm-commits mailing list