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

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 23:24:31 PDT 2022


sepavloff added a comment.

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

> The way I see it, there are two possibilities here:
>
> 1. In Sema, we have two rounding modes that correspond to FE_DYNAMIC: llvm::RoundingMode::Dynamic, and llvm::RoundingMode::NearestTiesToEven, plus some boolean to indicate whether the user actually explicitly specified FE_TONEAREST.  (You're currently missing the boolean, which means that currently "#pragma STDC FENV_ACCESS OFF" followed by "#pragma STDC FENV_ACCESS ON" actually mutates the rounding mode.) We juggle the rounding modes and the bit based on whether FENV_ACCESS is currently enabled.
> 2. We just have one rounding mode in Sema that corresponds to FE_DYNAMIC.  Then in CodeGen, we set the actual rounding mode based on whether FENV_ACCESS is currently enabled.
>
> (2) seems a lot simpler.

It makes sense. Updated the patch accordingly.


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