[llvm-bugs] [Bug 35594] New: Missed optimization in math expression: simplify calls std::exp functions
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Dec 10 04:24:31 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35594
Bug ID: 35594
Summary: Missed optimization in math expression: simplify calls
std::exp functions
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: zamazan4ik at tut.by
CC: llvm-bugs at lists.llvm.org
clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this
code:
#include <cmath>
double f(double a, double b)
{
return std::exp(a) * std::exp(b);
}
generates this assembly:
f(double, double): # @f(double, double)
sub rsp, 24
vmovsd qword ptr [rsp + 16], xmm1 # 8-byte Spill
call exp
vmovsd qword ptr [rsp + 8], xmm0 # 8-byte Spill
vmovsd xmm0, qword ptr [rsp + 16] # 8-byte Reload
call exp
vmulsd xmm0, xmm0, qword ptr [rsp + 8] # 8-byte Folded Reload
add rsp, 24
ret
GCC (trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags generates
more optimal code:
f(double, double):
vaddsd xmm0, xmm0, xmm1
jmp __exp_finite
--
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/20171210/f0f1b482/attachment.html>
More information about the llvm-bugs
mailing list