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

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 04:25:25 PDT 2022


sepavloff added a comment.

In D126364#3540673 <https://reviews.llvm.org/D126364#3540673>, @efriedma wrote:

> For FENV_ROUND, I think we should try to stick to the standard as closely as possible in Sema; since the standard models FENV_ROUND as a separate state, Sema should also model it as a separate state.

I try to figure out the difference between rounding mode as specified by FENV_ROUND and that represented by `Sema::CufFPFeatures`. The standard uses two notions for rounding mode:

- dynamic rounding mode, which is actually bits in a control register, and
- constant rounding mode, which is used for floating-point operators, implicit conversions and so on.

Dynamic rounding mode is set/queried by fegetround/fesetround/FLT_ROUNDS. It is unknown at compile time except that in default FP mode it is expected to be FE_TONEAREST.

What compiler can know is constant rounding mode, it is just the mode set by pragma FENV_ROUND.

It looks like `Sema::CufFPFeatures` is exactly what FENV_ROUND controls.
Do I miss something?


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