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

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 10:06:24 PDT 2023


sepavloff added a comment.

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, it represents rounding mode unknown at compiler time. `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.

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?


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

https://reviews.llvm.org/D156989



More information about the cfe-commits mailing list