[Nottingham] Compiler optimisation flags (gcc, g++)
Martin
martin at ml1.co.uk
Wed Nov 5 01:10:32 GMT 2003
Robert Davies wrote:
> On Monday 03 Nov 2003 15:12, Martin wrote:
>
>>Any pitfalls with using the following compiler optimisations for an
>>Athlon Palomino cpu system?
>
>
> Theres' been a recent article in Gentoo news, comparing some optimisation
> flags. One of the issues was -O3 slowing code down (due to bloat), if you
> want non-explicit function inlining then consider -finline-limit=N where N is
> some size smaller than the default. Altering alignments from defaults, also
> did not help, except if made much larger.
>
> The problem with flags is, they are very processor and program specific, it's
[...]
Ok folks,
Thanks for the feedback.
Links I've found useful are:
http://www.freehackers.org/gentoo/gccflags/flag_gcc3opt.html
http://reviewed.homelinux.org/en/howtoinstall.html
http://www.opq.se/sxs/index2.html
The exports script I'm now trying is:
>>>>
#
# mlgccflags.sh 2003-10-17 M Lomas
#
# Set the default optimisation flags for gcc
# Full optimisations for the AthlonXP on gcc 3.2.2
export MACHTYPE="i686-mandrake-linux-gnu"
export HOSTTYPE="i686"
export CHOST="i686-pc-linux-gnu"
export CFLAGS="-march=athlon-xp -O3 -fexpensive-optimizations
-funroll-loops -frerun-cse-after-loop -fr
erun-loop-opt -fomit-frame-pointer -fschedule-insns2
-minline-all-stringops -mfancy-math-387 -mfp-ret-i
n-387 -m3dnow -msse -mfpmath=sse -mmmx -malign-double
-falign-functions=4 -preferred-stack-boundary=4 -
fforce-addr -pipe"
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="$CFLAGS"
>>>>
(Beware the line breaks!)
A couple of very small test programs compile ok. I'll be trying bigger
stuff over the coming days.
Be careful to use gcc/g++ as appropriate. I've lost an hour over very
obscure linker problems due to using the wrong one... Duh!
Cheers,
Martin
--
----------------
Martin Lomas
martin at ml1.co.uk
----------------
More information about the Nottingham
mailing list