This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/83352] New: Missed optimization in math expression: sqrt(sqrt(a)) == pow(a, 1/4)
- From: "zamazan4ik at tut dot by" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 10 Dec 2017 14:54:26 +0000
- Subject: [Bug tree-optimization/83352] New: Missed optimization in math expression: sqrt(sqrt(a)) == pow(a, 1/4)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83352
Bug ID: 83352
Summary: Missed optimization in math expression: sqrt(sqrt(a))
== pow(a, 1/4)
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zamazan4ik at tut dot by
Target Milestone: ---
gcc(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this
code:
#include <cmath>
double test(double a)
{
return sqrt(sqrt(a));
}
generates this assembly:
test(double): # @test(double)
vsqrtsd xmm0, xmm0, xmm0
vsqrtsd xmm0, xmm0, xmm0
ret
But there is formula: sqrt(sqrt(a)) == pow(a, 1/4). And it can be compiled in
faster way.