[PATCH] D69870: [builtins] Implement rounding mode support for i386/x86_64
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 09:59:43 PST 2019
nickdesaulniers added inline comments.
================
Comment at: compiler-rt/lib/builtins/i386/fp_mode.c:19
+
+#define X87_INEXACT 0x20
+
----------------
This could be a local `const uint32_t` (local to `__fe_raise_inexact`).
================
Comment at: compiler-rt/lib/builtins/i386/fp_mode.c:43-45
+ cw &= X87_RMODE_MASK;
+
+ switch (cw) {
----------------
`switch (cw & X87_RMODE_MASK)`. LLVM will optimize such expressions in a switch.
================
Comment at: compiler-rt/lib/builtins/i386/fp_mode.c:66
+#ifdef __SSE_MATH__
+ uint32_t mxcsr;
+ __asm__ __volatile__ ("stmxcsr %0": "=m" (mxcsr));
----------------
Should you use `env.__mxcsr` here? If so, then the preprocessor guard differs from the above.
================
Comment at: compiler-rt/lib/builtins/i386/fp_mode.c:69
+ mxcsr |= X87_INEXACT;
+ __asm__ __volatile__ ("ldmxcsr %0": : "m" (mxcsr));
+#endif
----------------
Do *any* of these `asm` statements in this patch require `volatile` qualification?
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69870/new/
https://reviews.llvm.org/D69870
More information about the llvm-commits
mailing list