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

--- Comment #8 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Concerning the STDC FP_CONTRACT pragma, implementing it would not be
sufficient. GCC would also need to restrict how it does contraction, as it
currently does not contract only expressions, but also sequences of
expressions, which is invalid. Example:

double foo (double a, double b, double c)
{
  double p = a * b;
  return p + c;
}

Since a * b and p + c are separate expressions, contraction to FMA must not be
done according to the C standard. But when contraction is allowed, GCC
generates a FMA on my x86_64 processor:

        .cfi_startproc
        vfmadd132sd     %xmm1, %xmm2, %xmm0
        ret
        .cfi_endproc

Reply via email to