https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106902
--- Comment #45 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
C does not allow contracting x*y+z to fma(x, y, z) across statement boundaries
(contraction of x*y+z as one unbroken expression is controlled by the STDC
FP_CONTRACT pragma). In the following testcase:
__attribute__((noipa))
float f(float x, float y)
{
x *= x;
y *= y;
return x - y;
}
int main()
{
if (f(1./3, 1./3))
__builtin_abort();
}
we optimize 'f' to fma(x, x, -y*y) (under -O2 -mfma on x86), but by language
rules 'f' can return only 0 or NaN when invoked with x==y.