[PATCH] D139549: [X86][ConstraintFP] Model `MXCSR` for function call

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 17:38:03 PST 2023


pengfei added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:4474-4478
+  /// Returns a 0 terminated array of rounding control registers that can be
+  /// attached into strict FP call.
+  virtual const MCPhysReg *getRoundingControlRegisters() const {
+    return nullptr;
+  }
----------------
sepavloff wrote:
> The function name is a bit misleading, maybe `getFPEnvironmentRegisters` or some thing like that?
> 
> If this function lists FP environment registers that can be changed by a call, then any FP control mode register, not only rounding control (for example, denormal treatment or precision control) also can be modified. FP status information, like raised exception, also may be changed in the called procedure, so it is reasonable to include relevant registers as well.
> 
> MXCSR contains all this information but other architectures may have different registers for such information.
Thanks for the inputs! Modeling all the FP environment registers sounds attractive. However, it is not what the current strict FP required.
1. Denormal treatment is a good point. We haven't modeled it, but I think it's not a problem if we sort it into rounding control.
2. Precision as well as exception control registers do nothing with strict FP, because we just use MIFlag to ensure exception correctness.
3. The exception status registers are the same. We never use this information in strict FP.

In a word, only the rounding behaviors in strict FP mode relies on register modeling. So I think the name reflects the requirments correctly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139549



More information about the llvm-commits mailing list