Experimental flags to use for gcc 3.x
These flags are for people who want to experiment. This might break some application, and may cause errors, loss of data and other funny things.
Try some or all of these flags to the safe ones (march, pipe, O3, and fomit-frame-pointer):
-fprefetch-loop-arrays-ffast-math-fforce-addr (-fforce-mem is implied by -O3)-falign-functions=4-funroll-loops( bigger exe, maybe faster, usually not worth it)
Flags you do not need to add, since they are implied:
-march=pentium3implies -mmmx, -msse-O3implies -fstrict-aliasing -fexpensive-optimizations -force-mem -frerun-loop-opt -frerun-cse-after-loop-march=athlonimplies -m3dnow and -mmmx-march=athlon-tbirdimplies m3dnow and -mmmx
The following flags have been reported to work with gcc-3.2.x/gcc-3.3.x
Pentium III (Intel)
CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer -fforce-addr -falign-functions=4 -fprefetch-loop-arrays"CXXFLAGS="${CFLAGS}"
Athlon (AMD)
CFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer -ffast-math -funroll-loops -fforce-addr -falign-functions=4"CXXFLAGS="${CFLAGS}"
Athlon-tbird, aka K7 (AMD)
CFLAGS="-march=athlon-tbird -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -falign-functions=4 -maccumulate-outgoing-args"CXXFLAGS="${CFLAGS}"
Athlon XP 2000+
CFLAGS="-march=athlon-xp -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -ffast-math -fprefetch-loop-arrays"CXXFLAGS="${CFLAGS}"
0.1. Notes for PPC users
- For all PPC cflags add
-fsigned-char - There's no such thing as
-march=on PPC - For all 60X processors (603, 603e, 604, 604e, 604r..), do not use
-mcpu(broken) - For G3 use
-mcpu=750(not-march=) - For G4 use
-mcpu=7400(or7450) -O3is unstable on G4, use-O2
For G4, adds -maltivec. It will only be faster if the kernel is compiled with proper support for altivec, but at least,
it wont break if your kernel doesn't have it.
``
Do use -mabi=altivec if you use -maltivec.