https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105206

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor

--- Comment #1 from kargl at gcc dot gnu.org ---
Not sure if anyone cares.  I don't use -ffast-math, but this might considered a
mis-optimization with that option.

#include <math.h>

float
foof(float x)
{
   return (powf(10.f,x));
}

double
food(double x)
{
   return (pow(10.,x));
}


-fdump-tree-original shows

;; Function foof (null)
;; enabled by -tree-original

{
  return powf (1.0e+1, x);
}


;; Function food (null)
;; enabled by -tree-original

{
  return pow (1.0e+1, x);
}

Compiling to assembly shows

foof:
.LFB3:
        .cfi_startproc
        movaps  %xmm0, %xmm1
        movss   .LC0(%rip), %xmm0
        jmp     powf
        .cfi_endproc
food:
.LFB4:
        .cfi_startproc
        mulsd   .LC1(%rip), %xmm0
        jmp     exp
        .cfi_endproc

So, the middle-end is converting pow(10.x) to exp(x*log(10.0)) where log(10.0)
is reduced, but the same transformation of powf(10.f,x) still yields a call to
powf.

Reply via email to