-ansi flag slows down fma() operation

Andrew Haley aph@redhat.com
Sun Apr 12 18:39:00 GMT 2009

Martin Ettl wrote:
> Hello friends,
> i have made tests using the fma()-function and discovered an issue (see also this thread: http://gcc.gnu.org/ml/gcc-help/2009-04/msg00121.html). Brian Budge sent me a short benchmark programm to measure the execution time on my machine. Finally the fma() operation was faster than the a*b+c operation, but:
> If you use the -ansi flag to compile, then the fma()-operation takes 4-5-times longer, as without.
> So, now my question: Is this a known issue or an intendet behaviour? If yes, what other flags slow down such functions? Has anybody experienced a similiar case? 

fma() is new for C99.  In gcc, -ansi means C89, the old standard.
So, when you say -ansi the fast fma() builtin is disabled, and
a C library call is used instead.  You're seeing the effect of
disabling gcc builtin ofr fma().


More information about the Gcc-help mailing list