This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
- From: Tim Prince <TimothyPrince at sbcglobal dot net>
- To: Martin Ettl <ettl dot martin at gmx dot de>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 19 Apr 2009 10:49:56 -0700
- Subject: Re: What optimizaton flags should i use (g++-4.3.3,Linux,Core2Duo)?
- References: <20090419151801.146500@gmx.net>
- Reply-to: tprince at computer dot org
Martin Ettl wrote:
> i am playing around with g++-4.3.3 on Ubuntu Linux. The project i am working does a lot of floating point arithmetic (based on double variables). The testplattform i use, is a intel core 2 duo processor. So what optimization flags are good for this plattform? Currently i am using -O3 -funroll-loops, but there are a plenty other.
>
If you are using the 64-bit compiler, this may be sufficient, but
--param max-unrolled-insns=<your choice>
or
--param max-unroll-times=4
may be useful to make the unrolling less aggressive.
I suppose you're not using the 32-bit compiler, where you would set
-march=pentium-m
or
-march=prescott
or some other option, to enable partial or full use of sse2.
Add -msse3 if you like (either 32- or 64-bit), but you probably have no
use for it.
-fassociative-math (or, if it doesn't work, -ffast-math) are required for
vectorization of sum reductions. Otherwise, they may be undesirable.
They are saner in gfortran than in g++.
If you use OpenMP, of course you would set -fopenmp.