Skip to content

Commit ff0698b

Browse files
[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.
1 parent 15ce2e1 commit ff0698b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/docs/LangRef.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20392,8 +20392,8 @@ Example:
2039220392

2039320393
.. code-block:: text
2039420394

20395-
%a = call i8 @llvm.fptoui.sat.i8.f32(float 123.9) ; yields i8: 123
20396-
%b = call i8 @llvm.fptoui.sat.i8.f32(float -5.7) ; yields i8: 0
20395+
%a = call i8 @llvm.fptoui.sat.i8.f32(float 123.875) ; yields i8: 123
20396+
%b = call i8 @llvm.fptoui.sat.i8.f32(float -5.75) ; yields i8: 0
2039720397
%c = call i8 @llvm.fptoui.sat.i8.f32(float 377.0) ; yields i8: 255
2039820398
%d = call i8 @llvm.fptoui.sat.i8.f32(float 0xFFF8000000000000) ; yields i8: 0
2039920399

@@ -20445,8 +20445,8 @@ Example:
2044520445

2044620446
.. code-block:: text
2044720447

20448-
%a = call i8 @llvm.fptosi.sat.i8.f32(float 23.9) ; yields i8: 23
20449-
%b = call i8 @llvm.fptosi.sat.i8.f32(float -130.8) ; yields i8: -128
20448+
%a = call i8 @llvm.fptosi.sat.i8.f32(float 23.875) ; yields i8: 23
20449+
%b = call i8 @llvm.fptosi.sat.i8.f32(float -130.75) ; yields i8: -128
2045020450
%c = call i8 @llvm.fptosi.sat.i8.f32(float 999.0) ; yields i8: 127
2045120451
%d = call i8 @llvm.fptosi.sat.i8.f32(float 0xFFF8000000000000) ; yields i8: 0
2045220452

0 commit comments

Comments
 (0)