[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:19:18 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Will (williamfedele)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/115629.diff
1 Files Affected:
- (modified) llvm/docs/LangRef.rst (+4-4)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/115629
More information about the llvm-commits
mailing list