Date: Fri, 18 Aug 2006 21:40:19 -0500 From: "Nikolas Britton" <nikolas.britton@gmail.com> To: "Sean M." <sigma_zk@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: GCC - Optimal Optimization Message-ID: <ef10de9a0608181940j27d56911t6097581c0677ec8d@mail.gmail.com> In-Reply-To: <20060818214624.13326.qmail@web52310.mail.yahoo.com> References: <200608181800.k7II0tIg072158@lurza.secnetix.de> <20060818214624.13326.qmail@web52310.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 8/18/06, Sean M. <sigma_zk@yahoo.com> wrote: > --- Oliver Fromme <olli@lurza.secnetix.de> wrote: > > The default is "-O2 -fno-strict-aliasing -pipe". > > info gcc --index "optimize options" says the default is '-O0'. > That's true for stock GCC but FreeBSD (6.x) CFLAGS, COPTFLAGS, and CXXFLAGS defaults to "-O2 -fno-strict-aliasing -pipe". Try compiling a port without setting CFLAGS in /etc/make.conf and you will see what we mean. > > You said you don't want an increase in size. But that's > > exactly what -O3 (via inlining) and -funroll-loops do. > > If you want not to increase size, use the default flags. > > You could even use -Os, which instructs the compiler to > > optimize for small size (it's somewhere between -O and > > -O2). > > "-O3" was a typo, I meant "-O2". And I'm not against an absolute > increase in size, just a significant one (>10% is about where I'd start > to care) > -O2 is the default in FreeBSD 6.x maybe even in 5.5 too. Here's my make.conf, I run FreeBSD 6.1/i386 on an Athlon64 3200+: CPUTYPE?=athlon-xp CFLAGS+= -mtune=athlon64 COPTFLAGS+= -mtune=athlon64 .if ${.CURDIR:M*/devel/sdl1*} CFLAGS+= -O3 .endif Note that I don't have "-O2 -march=athlon-xp -mfpmath=sse -funroll-loops -pipe -ffast-math" etc. etc. in my conf file. The reason I don't have it in there is it breaks things! A better way to do this is on a port by port basis, that's what the .if block is for. Also note that I don't set CXXFLAGS. Why? because CXXFLAGS is set to whatever CFLAGS is set to. Also note the use of += and ?=, and the creative use of -mtune= to optimize the parts of the kernel, world, and ports that ignore CPUTYPE... BTW never put -march= in CFLAGS because it WILL break your system... Use CPUTYPE?= to set -march. > --- Nikolas Britton <nikolas.britton@gmail.com> wrote: > > IIRC the Duron should be set to athlon or athlon-tbird. The athlon-4, > > athlon-xp, athlon-mp knobs should only be used on Athlons with a > > Palomino core or better, your Duron is to slow to be based off > > Palomino. Also -mfp-math=sse does nothing for you because your chip > > doesn't have full SSE support. > > No, athlon-xp is valid: > "The second-generation Duron, the "Morgan" core, was sold in speed > grades between 900 and 1300 MHz, and was based on the 180 nm "Palomino" > Athlon XP core." [wikipedia.org] > My bad. > And -mfp-math=sse actually does nothing because there's not supposed to > be a hyphen between "fp" and "math". > You will break your system if you use that unconditionally. Use the .if .endif block I showed you if you really feel like using it... and... you better benchmark before and after because you may actually be slowing down the app. -- BSD Podcasts @: http://bsdtalk.blogspot.com/ http://freebsdforall.blogspot.com/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ef10de9a0608181940j27d56911t6097581c0677ec8d>