[PATCH] D142178: [X86][WIP] Change precision control to FP80 during u64->fp32 conversion on Windows.

icedrocket via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 22:03:52 PST 2023


icedrocket added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:37267-37290
+    // Load the old value of the control word...
+    Register OldCW = MF->getRegInfo().createVirtualRegister(&X86::GR32RegClass);
+    addFrameReference(BuildMI(*BB, MI, DL, TII->get(X86::MOVZX32rm16), OldCW),
+                      OrigCWFrameIdx);
+
+    // OR 0b11 into bit 8 and 9. 0b11 is the encoding for double extended
+    // precision.
----------------
icedrocket wrote:
> What about just set value to 0x37f instead of applying bitwise OR to original value? We can save two registers by doing this, and only need two bytes of memory to hold the static value.
> 
Ah, there is still the possibility of an exception being thrown due to a stack overflow. What if the original value's rounding mode is not round to nearest?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142178



More information about the llvm-commits mailing list