On 10/25/2017 10:28 AM, Joseph Myers wrote: > On Wed, 25 Oct 2017, vladimir.mezent...@oracle.com wrote: > >> +# Disable FMA (floating-point multiply-add) instructions for complex >> division. >> +# These instructions can produce different result if two operations >> executed separately. >> +LIBGCC2_FFP_CONTRAST_CFLAGS = -ffp-contract=off >> +LIB2_DIV3_FUNCS = _divdc3 _divhc3 _divsc3 > Without regard to whether the change is appropriate in the first place, > I'm doubtful of the logic for selecting floating-point modes. I'd expect > something that applies to all floating-point modes. Even if nothing has > fused XFmode operations, some architectures (e.g. s390, powerpc) have > fused operations on TFmode / KFmode.
Hello Joseph and GCC-team, Different people are giving me different directions. I am glad to change my fix but please provide clear directions on how you want to see it. michael.hud...@linaro.org created PR 59714 and suggested to set -ffp-contract=off: > int main(int argc, char** argv) > { > __complex double c = 1.0 + 3.0i; > printf("%g\n", __imag__ (c/c)); > } > ubuntu@arm64:~$ gcc cplx.c -o cplx > ubuntu@arm64:~$ ./cplx > -1.66533e-17 > > This is because libgcc2.c is compiled in a way that lets the compiler used > fused multiply add instructions. > It shouldn't be! > ... > In general, fma makes it hard to reason about expressions > like "a*b-c*d" -- which of the multiplications is being done at the higher precision? > But I guess arguing to fp-contract to default to off is a war I don't want to get into fighting. Thank you, -Vladimir