[PATCH] D74730: [FPEnv][X86] Implement lowering of llvm.set.rounding

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 09:48:42 PDT 2021


sepavloff added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:26949
+
+  // Store FP control word into memory.
+  SDValue Ops[] = {Chain, StackSlot};
----------------
pengfei wrote:
> I think we cannot assume x87 is always available https://godbolt.org/z/4MbsarMcP. GCC supports nox87 feature, @LiuChen3 is doing the same thing in LLVM in D100091.
> Furthermore, do we need to add a function call in case softfloat/libcall is used? Can we wisely generate one of them based on situation?
> I think we cannot assume x87 is always available https://godbolt.org/z/4MbsarMcP. GCC supports nox87 feature, @LiuChen3 is doing the same thing in LLVM in D100091.

Is there an x86 core that does not support x87 instructions? If no, then `-mno-80387`, similar to `-msoft-float` and `-mgeneral-regs-only` are proposed for the cases like Linux kernel, where access to FP hardware is undesirable because the modification of FP state requires saving/restoring it in process context. As `set_rounding` by essence modifies FP state, `-mno-80387` is identical to `-msoft-float`. By the way, GCC documentation list them as synonyms (https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html).

> Furthermore, do we need to add a function call in case softfloat/libcall is used? Can we wisely generate one of them based on situation?

I added checks for soft-float in constructor of `X86TargetLowering`. If this option is effect, this function is not used for lowering of `set_rounding`.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74730



More information about the llvm-commits mailing list