GNU GCC does not round floating-point divisions to the nearest value
Conversation
Replying to
Set -mfpmath=sse or avoid the legacy architecture. The only difference with Clang is that the default is SSE. If you pass -mfpmath=387 -mno-sse, Clang will act the same way as GCC does by default. So, either avoid the legacy architecture or configure it the way you want instead.
1
1
Replying to
Ok. I added -mfpmath=sse (see my script on GitHub). It does ***not*** help. See screenshot.
cc
2
1
It works fine here. Which GCC version are you using? I'm testing with GCC 10.1.0 and cannot reproduce your results.
1
I have a docker script, so you should be able to reproduce it. Just install docker and run my dockerscript.sh.
github.com/lemire/Code-us
1
You seem to be talking about 2 distinct issues:
1) GCC uses x87 floating point by default on x86 (pass -mfpmath=sse), unlike Clang
2) Neither Clang or GCC supports setting a non-default floating point rounding mode (which you'll notice more with optimization)
Rounding direction doesn't enter into what Daniel is observing at all. It's a complete red herring.
1
1
I think twitter.com/DanielMicay/st is a full explanation of everything being observed. It's 2 different things being noticed.
llvm.org/docs/LangRef.h documents that LLVM does not support the floating point environment without using special intrinsics and this applies to Clang.
Quote Tweet
Replying to @lemire and @stephentyrone
You seem to be talking about 2 distinct issues:
1) GCC uses x87 floating point by default on x86 (pass -mfpmath=sse), unlike Clang
2) Neither Clang or GCC supports setting a non-default floating point rounding mode (which you'll notice more with optimization)
1
Show replies


