[Bug middle-end/84996] Adding or substracting 0.0 could be optimized away even without -ffast-math

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Mar 20 16:46:00 GMT 2018


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

--- Comment #2 from Antony Polukhin <antoshkka at gmail dot com> ---
Then let's change the example to 

int test(int lhs) {
    return 0.0 + lhs;
}

In that case no signaling Nan is possible, but the code still does additions

test(int):
        pxor    xmm0, xmm0
        cvtsi2sd        xmm0, edi
        addsd   xmm0, QWORD PTR .LC0[rip]
        cvttsd2si       eax, xmm0
        ret


More information about the Gcc-bugs mailing list