-frename-registers is already implied by -O3, and -funit-at-a-time is already implied by -O2, hence also by -O3. -frename-registers is not a good idea - it increases compile time considerably (up to 30% more compile time, depending on the code being compiled) and it produces no measurable speedups on IA32 architectures since IA32 is very register-starved. In the past it was also the cause for a lot of bugs due to invalid code being produced, and it's being dropped from the -O set of overall flags in the 4.x GCC line, AFAIK. I'd turn it off explicitely if you insist on -O3, by adding -fno-rename-registers.Drysh wrote:Has anyone tested these two:
-frename-registers
-funit-at-a-time
I'm using them without any problem, but I would like to know what you think. The full line is:
CFLAGS="-march=pentium4m -O3 -pipe -fomit-frame-pointer -fno-ident -msse2 -falign-functions=4 -frename-registers -funit-at-a-time -mfpmath=sse"

The only flags I know of (asside from the obvious -fno-* flags) that disable previous flags are of the -O variety, for which the last -O flag specified takes effect.Satori80 wrote:I could use a little advice here. From what I understand GCC reads the last similar option as overriding the any previous similar flags. So if one were to put -mtune=athlon-xp -march=athlon-xp the -march flag should be used unless the ebuild filters out the -march flag, in which case the -mtune flag should be used. Correct?
If this is the case, why when I rebuild glibc are the flags switched to -march=athlon-xp -mtune=athlon-xp? Does this tune for athlon-xp rather than build for athlon-xp?


-frename-registers slows code compilation, not code exectution (which it can still theoretically improve, even on x86)codergeek42 wrote:Use "-O2" or "-Os" instead, since -O3 usually makes code actually go slower on x86 (which is due to its lack of many available registers).rafaelkafka wrote:-O3
You recall incorrectly.That's implied by "-fomit-frame-pointer" if I recall correctly.-momit-leaf-frame-pointer
It helps more than it hurts, but its not worth the hassle because of the packages you need to disable it for... Something to put on the backburner until package-specific cflags becomes friendlier.That breaks things. Don't use it.-ffast-math
-O3 also includes -finline-functions which causes unnecessary bloat in binaries which might make them execute slower. So -O2 is generally a better choice than -O3. -O3 should only be used for cpu intensive stuff, not everything.Bartlet wrote:-frename-registers slows code compilation, not code exectution (which it can still theoretically improve, even on x86)
It's true that -fomit-frame-pointer doesn't include -momit-leaf-frame-pointer. But they are useless togheter since -momit-leaf-frame-pointer overrides -fomit-frame-pointer. So you will get faster code by just using -fomit-frame-pointer.Bartlet wrote:You recall incorrectly.

Thank you very much!codergeek42 wrote:Use "-O2" or "-Os" instead, since -O3 usually makes code actually go slower on x86 (which is due to its lack of many available registers).rafaelkafka wrote:-O3That's implied by "-fomit-frame-pointer" if I recall correctly.-momit-leaf-frame-pointerThat breaks things. Don't use it.-ffast-math

I know that some of these flags are already included in -O3, but just wanna keep them there.CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -mtune=athlon-xp"
CFLAGS="${CFLAGS} -pipe"
CFLAGS="${CFLAGS} -O3"
CFLAGS="${CFLAGS} -fweb"
CFLAGS="${CFLAGS} -frename-registers"
CFLAGS="${CFLAGS} -fforce-addr"
CFLAGS="${CFLAGS} -momit-leaf-frame-pointer"
CFLAGS="${CFLAGS} -fomit-frame-pointer"
CFLAGS="${CFLAGS} -ftracer"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"

Code: Select all
CFLAGS="-Os -march=pentium4 -fomit-frame-pointer -pipe -funit-at-a-time"+1. I don't add any flags until I search high and low for what they do any all their drawbacks (thus my global CFLAGS are rather plain). I thought it would be nice to include -momit-leaf-frame-pointer for the packages that filter out -fomit-frame-pointer. I discovered -momit-leaf-frame-pointer actually OVERRIDES -fomit-frame-pointer for whatever reason. This seems illogical, one would think it should be the other way around, but it is not.It's true that -fomit-frame-pointer doesn't include -momit-leaf-frame-pointer. But they are useless togheter since -momit-leaf-frame-pointer overrides -fomit-frame-pointer. So you will get faster code by just using -fomit-frame-pointer.
you could add -fvisibility-inlines-hidden to your CXXFLAGS. It has good effect on c++ stuff like KDE, mozilla, Openoffice etc by reducing bloat.xordan wrote:Well I use:
CFLAGS="-march=athlon64 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
which seem quite sensibleIs there anything I can add which will give a noticable performance increase, without making things very unstable? I've read through quite a lot, and I haven't seen anything which doesn't either break things or bloat code so there's performance decrease due to that. Is there any point in having anything more than this in my flags?
"x86" doesn't cut it, be a little more specific. But the CFLAGS and CXXFLAGS when aiming for stability over all are always:IvanZD wrote:Hi!
What flags do you recommend for building a rock stable server? Speed is least important thing; only maximum stability is goal. X86 system.
Thx!
Code: Select all
CFLAGS="-march=<yourarch> -mtune=<yourarch> -O2 -fomit-frame-pointer -pipe -fno-ident"
CXXFLAGS="${CFLAGS}"Code: Select all
CFLAGS="-march=pentium3 -mtune=pentium3 -O2 -fomit-frame-pointer -pipe -fno-ident"
CXXFLAGS="${CFLAGS}"Thx, that was I looking for, but that I am wondering is: will -O1 or even without -O flag give more stable system than -O2 flag? Or I will get only equally stable and slower system?moocha wrote:Don't add or change anything else - all other flags trade off stability.Code: Select all
CFLAGS="-march=<yourarch> -mtune=<yourarch> -O2 -fomit-frame-pointer -pipe -fno-ident" CXXFLAGS="${CFLAGS}"
No, -O2 is the stable choice and there is no reason going any lower except if you care about compile times.IvanZD wrote:Thx, that was I looking for, but that I am wondering is: will -O1 or even without -O flag give more stable system than -O2 flag? Or I will get only equally stable and slower system?