[llvm] AMDGPU: Use extractBitsAsZExtValue to get exponent in trig_preop folding (PR #179024)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 31 01:19:51 PST 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/179024

None

>From 71015b555eefa33dc4fc74afd3bc3fbd5956f98d Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sat, 31 Jan 2026 09:29:13 +0100
Subject: [PATCH] AMDGPU: Use extractBitsAsZExtValue to get exponent in
 trig_preop folding

---
 llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index 84e9c2a83b304..2cd1902785546 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -1482,7 +1482,7 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
     if (!Cseg)
       break;
 
-    unsigned Exponent = (Fsrc.bitcastToAPInt().getZExtValue() >> 52) & 0x7ff;
+    unsigned Exponent = Fsrc.bitcastToAPInt().extractBitsAsZExtValue(11, 52);
     unsigned SegmentVal = Cseg->getValue().trunc(5).getZExtValue();
     unsigned Shift = SegmentVal * 53;
     if (Exponent > 1077)



More information about the llvm-commits mailing list