[llvm] d45022b - AMDGPU: Remove special case constant folding of divide
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 15:36:13 PDT 2023
Author: Matt Arsenault
Date: 2023-08-14T18:36:01-04:00
New Revision: d45022b094a0a00b52057b464902693bc4e2db76
URL: https://github.com/llvm/llvm-project/commit/d45022b094a0a00b52057b464902693bc4e2db76
DIFF: https://github.com/llvm/llvm-project/commit/d45022b094a0a00b52057b464902693bc4e2db76.diff
LOG: AMDGPU: Remove special case constant folding of divide
We should probably just swap this out for the fdiv, but that's what
the implementation is anyway.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index e6e474c6a50ec3..74aa494812b5e2 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -1437,15 +1437,7 @@ bool AMDGPULibCalls::evaluateScalarMathFunc(const FuncInfo &FInfo, double &Res0,
Res0 = tan(MATH_PI * opr0);
return true;
- case AMDGPULibFunc::EI_RECIP:
- Res0 = 1.0 / opr0;
- return true;
-
// two-arg functions
- case AMDGPULibFunc::EI_DIVIDE:
- Res0 = opr0 / opr1;
- return true;
-
case AMDGPULibFunc::EI_POW:
case AMDGPULibFunc::EI_POWR:
Res0 = pow(opr0, opr1);
diff --git a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
index 5ead0c157611d7..dd3977ff587d55 100644
--- a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
+++ b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
@@ -135,7 +135,7 @@ declare <16 x float> @_Z3sinDv16_f(<16 x float>)
declare <16 x float> @_Z3cosDv16_f(<16 x float>)
; GCN-LABEL: {{^}}define amdgpu_kernel void @test_native_recip
-; GCN: store float 0x3FD5555560000000, ptr addrspace(1) %a
+; GCN: %call = tail call fast float @_Z12native_recipf(float 3.000000e+00)
define amdgpu_kernel void @test_native_recip(ptr addrspace(1) nocapture %a) {
entry:
%call = call fast float @_Z12native_recipf(float 3.000000e+00)
@@ -146,7 +146,7 @@ entry:
declare float @_Z12native_recipf(float)
; GCN-LABEL: {{^}}define amdgpu_kernel void @test_half_recip
-; GCN: store float 0x3FD5555560000000, ptr addrspace(1) %a
+; GCN: %call = tail call fast float @_Z10half_recipf(float 3.000000e+00)
define amdgpu_kernel void @test_half_recip(ptr addrspace(1) nocapture %a) {
entry:
%call = call fast float @_Z10half_recipf(float 3.000000e+00)
More information about the llvm-commits
mailing list