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

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 07:51:32 PST 2024


Author: Will
Date: 2024-11-10T16:51:29+01:00
New Revision: ff0698b258eba9afd888159358c7369c3f85e9ae

URL: https://github.com/llvm/llvm-project/commit/ff0698b258eba9afd888159358c7369c3f85e9ae
DIFF: https://github.com/llvm/llvm-project/commit/ff0698b258eba9afd888159358c7369c3f85e9ae.diff

LOG: [LangRef] Fix examples for float to int saturating intrinsics (#115629)

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

Fixes #113529.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
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