[llvm-bugs] [Bug 35601] New: Missed optimization in math expression: sqrt(pow(a, 2.0)) == a
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Dec 10 07:20:20 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35601
Bug ID: 35601
Summary: Missed optimization in math expression: sqrt(pow(a,
2.0)) == 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, double b, double c, double d)
{
return sqrt(pow(a, 2.0));
}
generates this assembly:
test(double, double, double, double): # @test(double, double, double, double)
vmulsd xmm0, xmm0, xmm0
vsqrtsd xmm0, xmm0, xmm0
ret
gcc(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags generates
this:
test(double, double, double, double):
vandpd xmm0, xmm0, XMMWORD PTR .LC0[rip]
ret
.LC0:
.long 4294967295
.long 2147483647
.long 0
.long 0
--
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/b017ff52/attachment-0001.html>
More information about the llvm-bugs
mailing list