[llvm] Clarify semantics for overflowing constrainted lrint etc. (PR #148979)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 15:46:28 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Eli Friedman (efriedma-quic)
<details>
<summary>Changes</summary>
This fixes llvm.experimental.constrained.lrint and friends to use the same semantics as llvm.lrint and friends, as defined in in ba5c26da7ce85dbdcee3d964282e5f0981792702.
---
Full diff: https://github.com/llvm/llvm-project/pull/148979.diff
1 Files Affected:
- (modified) llvm/docs/LangRef.rst (+12-10)
``````````diff
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index d2a1821efd698..168045010df7e 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -28302,9 +28302,9 @@ Overview:
The '``llvm.experimental.constrained.lrint``' intrinsic returns the first
argument rounded to the nearest integer. An inexact floating-point exception
-will be raised if the argument is not an integer. An invalid exception is
-raised if the result is too large to fit into a supported integer type,
-and in this case the result is undefined.
+will be raised if the argument is not an integer. If the rounded value is too
+large to fit into the result type, an invalid exception is raised, and the
+return value is a non-deterministic value (equivalent to `freeze poison`).
Arguments:
""""""""""
@@ -28350,9 +28350,9 @@ Overview:
The '``llvm.experimental.constrained.llrint``' intrinsic returns the first
argument rounded to the nearest integer. An inexact floating-point exception
-will be raised if the argument is not an integer. An invalid exception is
-raised if the result is too large to fit into a supported integer type,
-and in this case the result is undefined.
+will be raised if the argument is not an integer. If the rounded value is too
+large to fit into the result type, an invalid exception is raised, and the
+return value is a non-deterministic value (equivalent to `freeze poison`).
Arguments:
""""""""""
@@ -28701,8 +28701,9 @@ Overview:
The '``llvm.experimental.constrained.lround``' intrinsic returns the first
argument rounded to the nearest integer with ties away from zero. It will
raise an inexact floating-point exception if the argument is not an integer.
-An invalid exception is raised if the result is too large to fit into a
-supported integer type, and in this case the result is undefined.
+If the rounded value is too large to fit into the result type, an invalid
+exception is raised, and the return value is a non-deterministic value
+(equivalent to `freeze poison`).
Arguments:
""""""""""
@@ -28739,8 +28740,9 @@ Overview:
The '``llvm.experimental.constrained.llround``' intrinsic returns the first
argument rounded to the nearest integer with ties away from zero. It will
raise an inexact floating-point exception if the argument is not an integer.
-An invalid exception is raised if the result is too large to fit into a
-supported integer type, and in this case the result is undefined.
+If the rounded value is too large to fit into the result type, an invalid
+exception is raised, and the return value is a non-deterministic value
+(equivalent to `freeze poison`).
Arguments:
""""""""""
``````````
</details>
https://github.com/llvm/llvm-project/pull/148979
More information about the llvm-commits
mailing list