better optimization flags for opteron (amd64)// -ffast-math and -O3 are not friends

David O'Brien obrien at freebsd.org
Fri Jul 22 03:49:40 GMT 2005


On Tue, Jul 19, 2005 at 05:26:09PM +0200, Olexandr Konovalenko wrote:
> I found that on my system combination of -ffast-math AND -O3 is slower than
> -O0 on AMD64 (interestingly it is true for Xeon EM64 as well), how can it be?
> though just -O3 gives fastest double precision floating point computations.

-O3 does a lot more than just FP optimizations.  It also does a lot of
inlining that can blow your caches.  It is a falicay that -ON is better
than -ON-1 level.  Look in the GCC manual at http://gcc.gnu.org - you'll
see all the optimizations that -O3 implies.  Start with -O2 and add ones
from the -O3 list to find the best performance for your benchmark on your
machine.

-- 
-- David  (obrien at FreeBSD.org)


More information about the freebsd-amd64 mailing list