[geeks] AMD64 compiler flags

Francisco Javier Mesa-Martinez lefa at ucsc.edu
Tue Oct 26 17:53:12 CDT 2004


On Tue, 26 Oct 2004 16:41:17 -0400
  Charles Shannon Hendrix <shannon at widomaker.com> wrote:
> I questions for anyone who has done much source build 
>optimization for
> AMD's 64-bit CPUs.
> 
> Any good websites with information on what compiler 
>options (GNU C) are
> good for these CPUs?
> 
> Any personal experiences?
> 

I assume you are using GCC, in our setup I can tell you 
which flags your should not use first:

the math flags for mmx and sse are useless, as is 
-march=k8 depending on which gcc version you are using. If 
your gcc is pure 64bit, then you also don't need the -m64 
flag, if you have a "generic" or are crosscrompile then 
use the -m64 to force 64bit execs. Also do not use -mtune 
it gave us a few headaches

On the 3.4 version you have 3 possible marchs depending on 
your system (-march=k8/athlon64/opteron)

So in my case I have been using -O3 -fPIC  -ffast-math 
-pipe -funroll-loops -frerun-cse-after-loop 
-frerun-loop-opt -fprefetch-loop-arrays -fforce-addr 
-falign-functions=4 -maccumulate-outgoing-args

But you may not need to be so aggressive, plus O3 covers 
some of those ops anyways, I just do it out of habit. I 
assume you are using a 64bit gcc and you want to generate 
64bit execs.



More information about the geeks mailing list