Walter Dnes wrote:

 Currently, I use "-march=i686" for my 3 machines, a P4, a PIII, and a
PII (and a partridge in a pear treeeeeeee<g>).

 According to the gcc docs at...
http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options

"i586 is equivalent to pentium and i686 is equivalent to pentiumpro."

 Does this mean that I would get better optimization if I use "pentium2",
"pentium3" or "pentium4", as appropriate?  I am using the available flags
(-mmmx, -msse, -msse2, -mfpmath=sse, etc) as appropriate.

Yes, it would.

My CFLAGS (Pentium II, 504 MHz, 224 MB RAM): "-O3 -march=pentium2 -mmmx -fomit-frame-pointer -pipe -ftracer -fno-rename-registers -funroll-loops"

I have a stable install of kernel 2.6.11-gentoo-r9 and GNOME 2.8.3. I haven't had a kernel panic yet, and I compiled and run the system with an overclocked 112 MHz front side bus. It was worth sitting around watching endless lines of text scroll by. My secrets?

-O3: The highest performance optimization level before code starts to break. It goes up to -O9 if you're daring. (Use -Os to compile for size.) Implies a lot of stuff. -march=pentium2: Implies -mmmx and writes code specifically for the P2 processor.
 -mmmx:  Build code with MMX instructions wherever possible.
-fomit-frame-pointer: Don't keep the frame pointer in a register. You get an extra register at the cost of losing debugging ability. -pipe: Use pipes instead of temporary files. Not recommended on a RAM-limited system. -ftracer: Use the processor's branch predictor when compiling. I think it compiles twice with this flag, but it does compile more efficiently. -fno-rename-registers: Renaming registers is only done when running 32-bit code on a 64-bit processor. It's implied on x86 architecture anyway. -funroll-loops: If you can tell how many times a loop will loop (mainly for loops), then unroll it. Does it increase performance? If it does, it's unnoticeable. Don't tell anyone you use it though. It spreads the whole "Gentoo ricer" myth that's been going around the Internet.

If your Pentium 4 supports Hyper-Threading, adjust MAKEOPTS accordingly. My P4 compiles faster at -j3 than -j2. (Haven't tried -j4 though.)

--
Colin

--
gentoo-user@gentoo.org mailing list

Reply via email to