[PATCH] D156989: FloatingPointMode: Use -1 for "Dynamic"

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 10:09:35 PDT 2023


arsenm added a comment.

In D156989#4558133 <https://reviews.llvm.org/D156989#4558133>, @sepavloff wrote:

> Rounding mode is presented in FPOptions with 3 bits, so there is only 8 values available for particular modes. 5 of them, which are specified in IEEE-754, are listed in `RoundingMode`. `Dynamic` (which is -1 in 3-bit numbers) is not a real rounding mode,

But it is a spec'd value as -1 for FLT_ROUNDS

> `RoundingMode::Invalid` is not a mode at all, it is used to represent unspecified value at compile-time and can be eliminated by using things like `std::optional`. In 3 bits it would have the same value as `Dynamic`, but it is not a problem, because `Invalid` never appears in AST and IR.

Right it's just filler here

> Probably `Dynamic` is what you need. It prevents from constant folding and other transformations that rely on particular rounding mode and does not restrict actual rounding modes used in runtime. What  prevents from using this mode for your case?

I can do better by reporting something meaningful, two different modes is not unknown. The enum here should just be exactly equal to the FLT_ROUNDS values and not pick a random other number, I just need the wrong value for Dynamic to get out of the way to avoid creating additional wrappers


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

https://reviews.llvm.org/D156989



More information about the cfe-commits mailing list