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

--- Comment #3 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> ---
I have tried to compile with -O3 -march=skylake -ffast-math and got this:

[asm]
test(double, double):
        vminsd  xmm2, xmm0, xmm1
        vcmplesd        xmm0, xmm0, xmm1
        vxorpd  xmm1, xmm1, xmm1
        vblendvpd       xmm0, xmm1, xmm2, xmm0
        ret
test2(double, double):
        vminsd  xmm2, xmm0, xmm1
        vcmpltsd        xmm0, xmm0, xmm1
        vxorpd  xmm1, xmm1, xmm1
        vblendvpd       xmm0, xmm1, xmm2, xmm0
        ret
[/asm]

And this is for -O3 -march=skylake -funsafe-math-optimizations. As you can see,
one instruction was eliminated from test2(). For some reason it was not
eliminated from test() function. I checked that -ffinite-math-only present in
-ffast-math prevented elimination of this extra instruction.

[asm]
test(double, double):
        vminsd  xmm2, xmm0, xmm1
        vcmplesd        xmm0, xmm0, xmm1
        vxorpd  xmm1, xmm1, xmm1
        vblendvpd       xmm0, xmm1, xmm2, xmm0
        ret
test2(double, double):
        vcmpnltsd       xmm1, xmm0, xmm1
        vxorpd  xmm2, xmm2, xmm2
        vblendvpd       xmm0, xmm0, xmm2, xmm1
        ret
[/asm]

Reply via email to