[PATCH] D126364: Fix interaction of pragma FENV_ACCESS with other pragmas

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 09:59:48 PDT 2022


efriedma added a comment.

> Constrained intrinsics don't change the rounding mode.

The standard text for FENV_ROUND requires that when we see a floating point operation, we have to perform it using the specified rounding mode.  "floating-point operators [...] shall be evaluated according to the specified constant rounding mode (as though no constant mode was specified and the corresponding dynamic rounding mode had been established by a call to fesetround)".  Like you've noted, we don't have any way to represent that directly in LLVM IR.  So the frontend probably needs to emit code to modify the rounding mode.

> Because of the requirement that the rounding mode be changed already, I don't see how instructions with static rounding modes are generally interesting. Perhaps a target will learn to recognize that a sequence of instructions can use the static rounding in the instructions and elide a change of rounding mode around the sequence? I don't know how common that would be in practice.

If you're using FENV_ROUND, presumably sequences involving rounding mode changes become more common.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126364



More information about the cfe-commits mailing list