[llvm] LangRef: rint, nearbyint: mention that default rounding mode is assumed (PR #77191)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 11:46:05 PST 2024


================
@@ -15751,7 +15751,9 @@ Semantics:
 """"""""""
 
 This function returns the same values as the libm ``rint`` functions
-would, and handles error conditions in the same way.
+would, and handles error conditions in the same way. The rounding mode
----------------
jcranmer-intel wrote:

This isn't how they're handled today, but I have a model of how to support FP exceptions better in LLVM IR, which draws from C's FENV_ACCESS rules. In non-exception-aware code, the state of the FP exception bits would be unspecified (probably `poison`) at any point in time, whereas exception-aware code would have the bits set as specified by IEEE 754. This model would largely reuse the existing intrinsics for operations (and with a few other changes I think could eliminate the need for duplicated constrained intrinsic versions), so I've already largely mentally mapped every such intrinsic to the corresponding IEEE 754 operation, even in cases where two operations would have the same effect but for exception handling, which technically requires the experimental constrained intrinsics at the moment.

In any case, I think the exception behavior doesn't need to be addressed by this patch.

https://github.com/llvm/llvm-project/pull/77191


More information about the llvm-commits mailing list