[llvm-bugs] [Bug 35602] New: Missed optimization in math expression: tan(a) * cos(a) == sin(a)
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Dec 10 07:25:38 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35602
Bug ID: 35602
Summary: Missed optimization in math expression: tan(a) *
cos(a) == sin(a)
Product: libraries
Version: trunk
Hardware: PC
OS: All
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 test(double a)
{
return tan(a) * cos(a);
}
generates this assembly:
test(double): # @test(double)
sub rsp, 24
vmovsd qword ptr [rsp + 8], xmm0 # 8-byte Spill
call tan
vmovsd qword ptr [rsp + 16], xmm0 # 8-byte Spill
vmovsd xmm0, qword ptr [rsp + 8] # 8-byte Reload
call cos
vmulsd xmm0, xmm0, qword ptr [rsp + 16] # 8-byte Folded Reload
add rsp, 24
ret
gcc(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags generates
this:
test(double):
jmp sin
--
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/19e3c0a5/attachment.html>
More information about the llvm-bugs
mailing list