https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714
Wilco <wilco at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-10-12
CC| |wilco at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #6 from Wilco <wilco at gcc dot gnu.org> ---
The question is whether the algorithm used in __divdc3 is accurate - it appears
to want to use FMA explictly, otherwise you'd see uses of TRUNC like in
__muldc3. When I build the example with -Ofast (adding volatile etc to avoid it
optimizing away), I get:
fmul d3, d3, d2
fmul d2, d2, d2
fnmsub d0, d0, d1, d3
fmadd d1, d1, d1, d2
fdiv d0, d0, d1
> ./a.out
0
With -O3:
bl __divdc3
> ./a.out
-1.66533e-17
So this bit of the code needs to be investigated for accuracy when using FMA:
if (FABS (c) < FABS (d))
{
ratio = c / d;
denom = (c * ratio) + d;
x = ((a * ratio) + b) / denom;
y = ((b * ratio) - a) / denom;
}
else
{
ratio = d / c;
denom = (d * ratio) + c;
x = ((b * ratio) + a) / denom;
y = (b - (a * ratio)) / denom;
}
As Richard already pointed out, this is a generic issue.