[geeks] AMD64 compiler flags

Charles Shannon Hendrix shannon at widomaker.com
Sat Nov 6 09:56:19 CST 2004


Tue, 26 Oct 2004 @ 15:53 -0700, Francisco Javier Mesa-Martinez said:

> the math flags for mmx and sse are useless, as is -march=k8 depending 
> on which gcc version you are using.                                   

Why do you say mmx and sse are useless? 

I find they have a huge impact on programs which can make use of their
functions.

Or did you mean they were useless on older gcc versions?

Right now I'm using:

% gcc --version
gcc (GCC) 3.3.4
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> 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

I thought -mtune was implied by -march...

What I'm curious about is how the system managed to run 64-bit execs on
a 32-bit OS.

> 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

I've tried a few of those.  I've not yet had time to do much testing.

Mainly I want to gain speed safely.  Reliability is more important to
me, but since I have a new CPU I might as well take advantage of it
where possible.

One thing I find useful is -Os.  I often find it more useful to shrink
the binary since so many systems like Gnome fire off little execs over
and over and over, so saving some loading/paging time is useful.

> 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.

No, I'm running a 32-bit kernel and C library.

I thought about playing with a 64-bit BSD or Linux distribution, but
haven't really researched it much yet.


-- 
shannon "AT" widomaker.com -- ["People should have access to the data which
you have about them.  There should be a process for them to challenge any
inaccuracies." -- Arthur Miller]



More information about the geeks mailing list