Skip to content

Commit d45022b

Browse files
committed
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.
1 parent 483cc21 commit d45022b

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,15 +1437,7 @@ bool AMDGPULibCalls::evaluateScalarMathFunc(const FuncInfo &FInfo, double &Res0,
14371437
Res0 = tan(MATH_PI * opr0);
14381438
return true;
14391439

1440-
case AMDGPULibFunc::EI_RECIP:
1441-
Res0 = 1.0 / opr0;
1442-
return true;
1443-
14441440
// two-arg functions
1445-
case AMDGPULibFunc::EI_DIVIDE:
1446-
Res0 = opr0 / opr1;
1447-
return true;
1448-
14491441
case AMDGPULibFunc::EI_POW:
14501442
case AMDGPULibFunc::EI_POWR:
14511443
Res0 = pow(opr0, opr1);

llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ declare <16 x float> @_Z3sinDv16_f(<16 x float>)
135135
declare <16 x float> @_Z3cosDv16_f(<16 x float>)
136136

137137
; GCN-LABEL: {{^}}define amdgpu_kernel void @test_native_recip
138-
; GCN: store float 0x3FD5555560000000, ptr addrspace(1) %a
138+
; GCN: %call = tail call fast float @_Z12native_recipf(float 3.000000e+00)
139139
define amdgpu_kernel void @test_native_recip(ptr addrspace(1) nocapture %a) {
140140
entry:
141141
%call = call fast float @_Z12native_recipf(float 3.000000e+00)
@@ -146,7 +146,7 @@ entry:
146146
declare float @_Z12native_recipf(float)
147147

148148
; GCN-LABEL: {{^}}define amdgpu_kernel void @test_half_recip
149-
; GCN: store float 0x3FD5555560000000, ptr addrspace(1) %a
149+
; GCN: %call = tail call fast float @_Z10half_recipf(float 3.000000e+00)
150150
define amdgpu_kernel void @test_half_recip(ptr addrspace(1) nocapture %a) {
151151
entry:
152152
%call = call fast float @_Z10half_recipf(float 3.000000e+00)

0 commit comments

Comments
 (0)