Repository navigation
Default to SSE2 floating point math on x86 - #430
Conversation
The x86 kit and the x64 kit's -m32 target pentium4, so SSE2 is always enabled, yet GCC still defaulted to -mfpmath=387 for 32-bit code. x87 math keeps 80-bit intermediates (FLT_EVAL_METHOD 2), so a value can change when spilled to memory, and results differ from x64's. Configure GCC --with-fpmath=sse, which makes SSE2 math the default whenever SSE2 is enabled: -march=i686 still gets x87. long double stays x87, and the 32-bit ABI still returns floats in st(0).
|
For 32-bits, the only use of x87 in the ABI is for float return values. They end up in Surprised we haven't noticed all of these years! |
Yeah! How did you notice this? My Mandelbrot test at (This is making me re-think my possible no PR policy elsewhere that we discussed. Sometimes it's simpler to express an idea with code than to explain it.) |
|
I noticed because I was working on the 32-bit XP prospero build and a bunch of tests failed due to the different precision. I've also been separately researching different float formats and trying to learn more about them. I sent a patch to gcc regarding the configurable precision of x87 that I CC'd you on that you may have noticed. I'll put that info in a blog post at some point. You'll probably find it interesting. |
The x86 kit and the x64 kit's -m32 target pentium4, so SSE2 is always enabled, yet GCC still defaulted to -mfpmath=387 for 32-bit code. x87 math keeps 80-bit intermediates (FLT_EVAL_METHOD 2), so a value can change when spilled to memory, and results differ from x64's. Configure GCC --with-fpmath=sse, which makes SSE2 math the default whenever SSE2 is enabled: -march=i686 still gets x87. long double stays x87, and the 32-bit ABI still returns floats in st(0).