[llvm] AMDGPU: Simplify synthesis of nextdown(1.0) constant (PR #189039)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 27 09:10:58 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/189039.diff
1 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (+3-5)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
index 79c6a50d77aec..fe5624d824f94 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
@@ -2052,13 +2052,11 @@ Value *AMDGPUCodeGenPrepareImpl::matchFractPat(IntrinsicInst &I) {
if (!match(Arg1, m_APFloatAllowPoison(C)))
return nullptr;
- APFloat One(1.0);
- bool LosesInfo;
- One.convert(C->getSemantics(), APFloat::rmNearestTiesToEven, &LosesInfo);
+ APFloat OneNextDown = APFloat::getOne(C->getSemantics());
+ OneNextDown.next(true);
// Match nextafter(1.0, -1)
- One.next(true);
- if (One != *C)
+ if (OneNextDown != *C)
return nullptr;
Value *FloorSrc;
``````````
</details>
https://github.com/llvm/llvm-project/pull/189039
More information about the llvm-commits
mailing list