[Bug tree-optimization/86855] REGRESSON: [8.0] -Ofast optimize away mm_set_ps(0.0f,0.0f,-0.0f,0.0f);

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 4 14:40:00 GMT 2018


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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
It happens during inlining.
If I write instead:
const __m128 neg={0.0f,0.0f,-0.0f,-0.0f};
then the front-end already turns it into
const __m128 neg = { 0.0, 0.0, 0.0, 0.0 };
You really need -fsigned-zeros to counteract what -Ofast is doing there.

The question is whether we should have a way to ignore signed zero arithmetic
issues (simplify x+(±0.) to x) without arbitrarily changing the sign of a
constant 0 we happen to have already, which may be used in weird bit
operations. That may not be trivial to specify, but the special case of SSE on
x86 is a motivation.

Workarounds may include specifying the vector as an integer vector, going
through inline asm to hide the constants, etc.


More information about the Gcc-bugs mailing list