[PATCH] D77379: [FPEnv] Use single enum to represent rounding mode

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 15:43:42 PDT 2020


rjmccall added inline comments.


================
Comment at: llvm/include/llvm/ADT/FloatingPointMode.h:26
+/// assigned to the rounding modes must agree with the values used by FLT_ROUNDS
+/// (C11, 5.2.4.2.2p8).
+enum class RoundingMode : int8_t {
----------------
I agree that we should use one enum across LLVM and Clang.  I'm not sure that using the `FLT_ROUNDS` values is worthwhile, especially since (1) `FLT_ROUNDS` doesn't specify a value for some of these (like `NearestTiesToAway`) and (2) some of the values it does use (e.g. for "indeterminable") make this actively more awkward to store.  And the most useful thing we could do — matching the values of `FE_TONEAREST` and so on — isn't possible because those values are unportable.  I'd rather we just pick arbitrary, non-ABI-stable values, like we normally would, and then make the places that rely on matching some external schema translate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77379





More information about the llvm-commits mailing list