Closed
Description
Bugzilla Link | 35593 |
Version | trunk |
OS | All |
Blocks | #34959 |
CC | @rotateright |
Extended Description
clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this code:
#include <cmath>
double f(double a, double b, double c)
{
return std::pow(a, b) * std::pow(a, c);
}
generates this assembly:
f(double, double, double): # @f(double, double, double)
sub rsp, 24
vmovsd qword ptr [rsp + 16], xmm2 # 8-byte Spill
vmovsd qword ptr [rsp], xmm0 # 8-byte Spill
call pow
vmovsd qword ptr [rsp + 8], xmm0 # 8-byte Spill
vmovsd xmm0, qword ptr [rsp] # 8-byte Reload
vmovsd xmm1, qword ptr [rsp + 16] # 8-byte Reload
call pow
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, double):
vaddsd xmm1, xmm1, xmm2
jmp __pow_finite