[Bug middle-end/105206] mis-optimization with -ffast-math and __builtin_powf

sgk at troutmask dot apl.washington.edu gcc-bugzilla@gcc.gnu.org
Mon Apr 11 19:21:52 GMT 2022


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

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Mon, Apr 11, 2022 at 02:45:22PM +0000, kargl at gcc dot gnu.org wrote:
> 
> This might be related to PR89125.  The patch I attached to that PR has never
> found its way into the repository.  I'll do some more testing later today.
> 

Yep.  This is related to PR89125.  GCC does not use configure
to check for the availability of individual C99 libm functions.
After updating the patch in PR89125 for the *.c to *.cc migration
the patch gcc gives

foof:
.LFB3:
        .cfi_startproc
        mulss   .LC0(%rip), %xmm0
        jmp     expf
        .cfi_endproc

food:
.LFB4:
        .cfi_startproc
        mulsd   .LC1(%rip), %xmm0
        jmp     exp
        .cfi_endproc

fool:
.LFB5:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        fldt    16(%rbp)
        popq    %rbp
        .cfi_def_cfa 7, 8
        fldt    .LC2(%rip)
        fmulp   %st, %st(1)
        fldl2e
        fmulp   %st, %st(1)
        fld     %st(0)
        frndint
        fsubr   %st, %st(1)
        fxch    %st(1)
        f2xm1
        fld1
        faddp   %st, %st(1)
        fscale
        fstp    %st(1)
        ret
        .cfi_endproc


More information about the Gcc-bugs mailing list