https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170
--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Hongtao.liu from comment #5) > (In reply to Antony Polukhin from comment #2) > > -fno-trapping-math had no effect > > > > Some tests with nans seem to produce the same results for both code > > snippets: https://godbolt.org/z/GaKM3EhMq > > What about infinity, I notice > With -ffinite-math-only -funsafe-math-optimizations, gcc now can generate > > __cond_swap(double*, double*): > movsd (%rdi), %xmm0 > movsd (%rsi), %xmm1 > movapd %xmm0, %xmm2 > minsd %xmm1, %xmm0 > maxsd %xmm1, %xmm2 > movsd %xmm2, (%rsi) > movsd %xmm0, (%rdi) > ret Assume -funsafe-math-optimizations is not needed?