Re: Optimization flags

Jeremy Barnes <[email protected]> Wed, 30 Mar 2005 14:52:07 -0500
Newsgroups gmane.linux.mandrake.cooker.amd64
Organization Idilia Inc
Message-ID <[email protected]>
On March 30, 2005 02:43 pm, Giuseppe Ghibò wrote:
> Application writers flags are generally replaced by %optflags on
> compilation. And anyway they tend to use only -O2 (or often -O -g) which is
> the best safe flag for every platforms. Even the "atlas" math libraries
> don't tend to use the best possible flags on certain newer platform.

The main point is that one shouldn't put any unsafe (possibility of wrong code 
or possibility of major performance regressions) code in the default 
optflags.  Unfortunately what provides a speedup on one application tends to 
often slow down another.  Applications which are extremely performance 
sensitive (media encoders, linear algebra, etc) tend to have hand-tuned 
assembly routines anyway (which should be independent of the compiler); for 
example the ATLAS build instructions actually tell you to *not* put the 
optimisation level up too high as this will interfere with its instruction 
scheduling.

> I just cited the best optimization flags I experienced on Opterons,
> as term of comparisons (or gain) with respect to standard one. I don't have
> said to use them.
>
> Anyway, what about adding just -msse -msse2? Are they already
> implicit to for gcc for X86-64 arch (because of default -mfpmath=sse)?

OK, point taken.  The -msse and -msse2 are already implicit on x86-64, as is 
-mfpmath=sse, so nothing needs to be changed here.

Jeremy