[llvm-bugs] [Bug 35706] New: Missed optimization in math expression: log10(pow(10.0, x)) == x
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 20 07:57:18 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35706
Bug ID: 35706
Summary: Missed optimization in math expression:
log10(pow(10.0,x)) == x
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: zamazan4ik at tut.by
CC: llvm-bugs at lists.llvm.org
Clang (trunk) with '-O3 -std=c++17 -ffast-math' for this code:
#include <cmath>
double test10(double x)
{
return log10(pow(10.0, x));
}
double test2(double x)
{
return log2(pow(2.0, x));
}
generates this:
.LCPI0_0:
.quad 4621819117588971520 # double 10
test10(double): # @test10(double)
push rax
movaps xmm1, xmm0
movsd xmm0, qword ptr [rip + .LCPI0_0] # xmm0 = mem[0],zero
call pow
pop rax
jmp log10 # TAILCALL
test2(double): # @test2(double)
push rax
call exp2
pop rax
jmp log2 # TAILCALL
But we can simplify it by logX(pow(X,Y)) == Y.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171220/ff7faaa9/attachment-0001.html>
More information about the llvm-bugs
mailing list