[llvm] [LangRef] Fix examples for float to int saturating intrinsics (PR #115629)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 19:18:20 PST 2024


https://github.com/williamfedele created https://github.com/llvm/llvm-project/pull/115629

See #113529 for raised issue.

As per the [LangRef:Simple Constants](https://llvm.org/docs/LangRef.html#simple-constants), exact decimal values of floating-point constants are required. For instance, 23.9 is a repeating decimal in binary and results in the reported error.

https://godbolt.org/z/1h7ETPnf6

>From f948a8834ba144f83b800177b435ad385da52d21 Mon Sep 17 00:00:00 2001
From: Will <47335043+williamfedele at users.noreply.github.com>
Date: Sat, 9 Nov 2024 22:06:56 -0500
Subject: [PATCH] [LangRef] Fix examples for float to int saturating intrinsics

See #113529 for raised issue.
---
 llvm/docs/LangRef.rst | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e426140f328315..8fe4b1bd40e215 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -20392,8 +20392,8 @@ Example:
 
 .. code-block:: text
 
-      %a = call i8 @llvm.fptoui.sat.i8.f32(float 123.9)              ; yields i8: 123
-      %b = call i8 @llvm.fptoui.sat.i8.f32(float -5.7)               ; yields i8:   0
+      %a = call i8 @llvm.fptoui.sat.i8.f32(float 123.875)            ; yields i8: 123
+      %b = call i8 @llvm.fptoui.sat.i8.f32(float -5.75)              ; yields i8:   0
       %c = call i8 @llvm.fptoui.sat.i8.f32(float 377.0)              ; yields i8: 255
       %d = call i8 @llvm.fptoui.sat.i8.f32(float 0xFFF8000000000000) ; yields i8:   0
 
@@ -20445,8 +20445,8 @@ Example:
 
 .. code-block:: text
 
-      %a = call i8 @llvm.fptosi.sat.i8.f32(float 23.9)               ; yields i8:   23
-      %b = call i8 @llvm.fptosi.sat.i8.f32(float -130.8)             ; yields i8: -128
+      %a = call i8 @llvm.fptosi.sat.i8.f32(float 23.875)             ; yields i8:   23
+      %b = call i8 @llvm.fptosi.sat.i8.f32(float -130.75)            ; yields i8: -128
       %c = call i8 @llvm.fptosi.sat.i8.f32(float 999.0)              ; yields i8:  127
       %d = call i8 @llvm.fptosi.sat.i8.f32(float 0xFFF8000000000000) ; yields i8:    0
 



More information about the llvm-commits mailing list