[llvm] 5688aca - AMDGPU: Simplify synthesis of nextdown(1.0) constant (#189039)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 09:42:06 PDT 2026


Author: Matt Arsenault
Date: 2026-03-27T16:42:01Z
New Revision: 5688aca96ea22c599407e90e85e0c54b27295ddf

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

LOG: AMDGPU: Simplify synthesis of nextdown(1.0) constant (#189039)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp

Removed: 
    


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


        


More information about the llvm-commits mailing list