[llvm] AMDGPU: Add a test for libcall simplify pow handling (PR #180491)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 01:21:57 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

This case could be turned into powr or pown, so track which
case ends up preferred.

---
Full diff: https://github.com/llvm/llvm-project/pull/180491.diff


1 Files Affected:

- (modified) llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll (+14) 


``````````diff
diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll
index e1e0c1828a430..193e3a740b92e 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-pow.ll
@@ -2462,6 +2462,20 @@ define float @test_pow_f32_known_positive_x__known_integral_sitofp(float nofpcla
   ret float %pow
 }
 
+define float @test_pow_f32__known_positive_x__known_integral_y(float nofpclass(ninf nnorm nsub nzero) %x, i32 %y.int) #0 {
+; CHECK-LABEL: define float @test_pow_f32__known_positive_x__known_integral_y
+; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[X:%.*]], i32 [[Y_INT:%.*]]) #[[ATTR2]] {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[Y:%.*]] = sitofp i32 [[Y_INT]] to float
+; CHECK-NEXT:    [[CALL:%.*]] = tail call float @_Z4powrff(float [[X]], float [[Y]])
+; CHECK-NEXT:    ret float [[CALL]]
+;
+entry:
+  %y = sitofp i32 %y.int to float
+  %call = tail call float @_Z3powff(float %x, float %y)
+  ret float %call
+}
+
 define float @test_pow_afn_f32_known_positive_x__known_integral_sitofp(float nofpclass(ninf nsub nnorm) %x, i32 %y) {
 ; CHECK-LABEL: define float @test_pow_afn_f32_known_positive_x__known_integral_sitofp
 ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[X:%.*]], i32 [[Y:%.*]]) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/180491


More information about the llvm-commits mailing list