[llvm] Clarify semantics for overflowing constrainted lrint etc. (PR #148979)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 15:45:58 PDT 2025
https://github.com/efriedma-quic created https://github.com/llvm/llvm-project/pull/148979
This fixes llvm.experimental.constrained.lrint and friends to use the same semantics as llvm.lrint and friends, as defined in in ba5c26da7ce85dbdcee3d964282e5f0981792702.
>From f51ccbd19c8de32e47496c8235f378ca41d214f0 Mon Sep 17 00:00:00 2001
From: Eli Friedman <efriedma at quicinc.com>
Date: Tue, 15 Jul 2025 15:19:52 -0700
Subject: [PATCH] Clarify semantics for overflowing constrainted lrint etc.
This fixes llvm.experimental.constrained.lrint and friends to use the
same semantics as llvm.lrint and friends, as defined in
in ba5c26da7ce85dbdcee3d964282e5f0981792702.
---
llvm/docs/LangRef.rst | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
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:
""""""""""
More information about the llvm-commits
mailing list