Experimental flags to use for gentoo-1.4

Moderator: Forums Team

Post Reply
pahud
24hr 義工
Posts: 1251
Joined: Tue Nov 26, 2002 10:22 pm
Contact:

Experimental flags to use for gentoo-1.4

Post by pahud »

http://www.freehackers.org/gentoo/gccfl ... c3opt.html
Those flags are for gcc-3.x and alike (mostly gcc-3.0, gcc-3.1.1 and gcc-3.2), you may check which gcc you're using with the following command : How to know your gcc version

#gcc --version


You can know which CPU you have with the following command : How to know your CPU type

cat /proc/cpuinfo






--------------------------------------------------------------------------------


Ok, you really want to optimize your box to death, even if that means spending times experimenting stuff, and sometimes breaking your box ? Eventually, the flags combination that prove stable here will go on the safe flag page If you can't see any line here, that means nobody has reported either success or failure with any flags... wanna test ? The first thing you want to test are the following flags (don't forget to add -pipe -O3 -march=XXX -fomit-frame-pointer, which is the bare minimum)


-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, I don't use it)
The following flags have been reported to work with gentoo 1.4 (gcc-3.2). The CHOST is unrelated to compiler flags, you should use the exact same one as found on the safe flags page

note : -fstrict-aliasing -fexpensive-optimizations -force-mem -frerun-loop-opt -frerun-cse-after-loop are implied by -O3, see the FAQ
--------------------------------------------------------------------------------

Pentium III (Intel)

CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer
-fforce-addr -falign-functions=4 -fprefetch-loop-arrays"
CXXFLAGS="${CFLAGS}"

note : -mmmx, -msse are implied by -march=pentium3




--------------------------------------------------------------------------------
Athlon (AMD)

CFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer
-ffast-math -funroll-loops -fforce-addr -falign-functions=4"
CXXFLAGS="${CFLAGS}"

note : -m3dnow and -mmmx optimisations are implied by -march=athlon

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}"

note : -m3dnow and -mmmx optimisations are implied by -march=athlon-tbird


Someone reported having a system working with no problem on an Athlon XP 2000+ with : 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}"






--------------------------------------------------------------------------------

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 (or 7450)
-O3 is 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.
Post Reply