[PATCH] D137811: InstCombine: Perform basic isnan combines on llvm.is.fpclass

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 07:57:37 PST 2023


arsenm added a comment.

In D137811#4085761 <https://reviews.llvm.org/D137811#4085761>, @jcranmer-intel wrote:

> On a strict reading of the standard, on transition from `get_code` (which has `FENV_ACCESS OFF`) back to `func2`, the FP flags are unspecified, which means it is legal to transform the non-flag-setting `isnan` into flag-setting `fcmp`. There is a slight wording mismatch, as `FENV_ACCESS` is about //testing//, not //setting// flags, but the footnote seems to indicate that the correct reading is that `FENV_ACCESS` is necessary if you want guarantees about flags being set or not set.
>
> If it would help, I could contact the CFP study group to see what they think is the correct reading of the standard.

For the purpose of this change, the exact definition of FENV_ACCESS doesn't matter. This is not something that the context of a single instruction can or should consider. This would have to be managed by implicit mode switches inserted by the frontend to maintain the invariant that non-strict functions don't have to be concerned about it. Our strictfp representation would be totally broken if we had to think about this in a non-strict function


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

https://reviews.llvm.org/D137811



More information about the llvm-commits mailing list