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.