[PATCH] D68810: Document rounding and exceptions for llvm.lround and llvm.lrint

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 09:36:29 PDT 2019


kpn created this revision.
kpn added a reviewer: hfinkel.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The handling of rounding, and the handling of exceptions, is not documented for the llvm.lround and llvm.lrint family of intrinsics.

This documentation was requested during the reviews of D64746 <https://reviews.llvm.org/D64746>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68810

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -12620,13 +12620,18 @@
 Overview:
 """""""""
 
-The '``llvm.lround.*``' intrinsics returns the operand rounded to the
-nearest integer.
+The '``llvm.lround.*``' intrinsics return the operand rounded to the nearest
+integer with ties away from zero. It will raise an inexact floating-point
+exception if the operand 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.
+
 
 Arguments:
 """"""""""
 
-The argument is a floating-point number and return is an integer type.
+The argument is a floating-point number and the return value is an integer
+type.
 
 Semantics:
 """"""""""
@@ -12654,13 +12659,17 @@
 Overview:
 """""""""
 
-The '``llvm.llround.*``' intrinsics returns the operand rounded to the
-nearest integer.
+The '``llvm.llround.*``' intrinsics return the operand rounded to the nearest
+integer with ties away from zero. It will raise an inexact floating-point
+exception if the operand 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.
 
 Arguments:
 """"""""""
 
-The argument is a floating-point number and return is an integer type.
+The argument is a floating-point number and the return value is an integer
+type.
 
 Semantics:
 """"""""""
@@ -12694,13 +12703,18 @@
 Overview:
 """""""""
 
-The '``llvm.lrint.*``' intrinsics returns the operand rounded to the
-nearest integer.
+The '``llvm.lrint.*``' intrinsics return the operand rounded to the nearest
+integer. An inexact floating-point exception will be raised if the operand
+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.
+
 
 Arguments:
 """"""""""
 
-The argument is a floating-point number and return is an integer type.
+The argument is a floating-point number and the return value is an integer
+type.
 
 Semantics:
 """"""""""
@@ -12728,13 +12742,17 @@
 Overview:
 """""""""
 
-The '``llvm.llrint.*``' intrinsics returns the operand rounded to the
-nearest integer.
+The '``llvm.llrint.*``' intrinsics return the operand rounded to the nearest
+integer. An inexact floating-point exception will be raised if the operand
+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.
 
 Arguments:
 """"""""""
 
-The argument is a floating-point number and return is an integer type.
+The argument is a floating-point number and the return value is an integer
+type.
 
 Semantics:
 """"""""""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68810.224387.patch
Type: text/x-patch
Size: 2849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191010/47c6f71e/attachment.bin>


More information about the llvm-commits mailing list