Hi,

I think this should be part of the same transition, as without it, gcc will often prefer x87 instructions even if SSE is available, because that is the cheapest way to be compatible to the 32-bit ABI.

For example:

    double square(double num) {
        return num * num;
    }

without -mfpmath=sse becomes

    square(double):
        fld     QWORD PTR [esp+4]
        fmul    st, st(0)
        ret

even if SSE2 is available, because the return value is expected at the top of the FP stack. With -mfpmath=sse, it is explicitly loaded there:

    square(double):
        sub     esp, 12
        movsd   xmm0, QWORD PTR [esp+16]
        mulsd   xmm0, xmm0
        movsd   QWORD PTR [esp], xmm0
        fld     QWORD PTR [esp]
        add     esp, 12
        ret

   Simon

Reply via email to