From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 7953 invoked from network); 16 Jul 1998 15:30:02 -0000 Received: from stefan.sime.com (193.228.80.247) by mail2.redhat.com with SMTP; 16 Jul 1998 15:30:02 -0000 Received: (from stefan@localhost) by stefan.sime.com (8.8.7/8.8.7) id RAA09614; Thu, 16 Jul 1998 17:26:49 +0200 Date: Thu, 16 Jul 1998 17:26:49 +0200 Message-Id: <199807161526.RAA09614@stefan.sime.com> From: Quant-X Alpha Linux Support To: axp-list@redhat.com CC: rth@cygnus.com In-reply-to: <19980716032019.A6773@kg1.ping.de> (message from Kurt Garloff on Thu, 16 Jul 1998 03:20:19 +0200) Subject: Re: flags for egcs on alpha Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Sender: Quant-X Alpha Linux Support Reply-To: Quant-X Alpha Linux Support Organization: Quant-X Service & Consulting Ges.m.b.H. Hi ! > On Wed, Jul 15, 1998 at 05:38:08PM -0700, Richard Henderson wrote: > > > I just loaded egcs 1.0.3a and want to get the best floating > > > point performance from it on my Alpha. What optimization flags > > > should I use?? > > > > In general? -O2. > > I use -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti. > Consider specifying your cpu if your compiler doesn't default to it: > -mcpu=ev5 No compiler can make perfect code. It's a hard to make egcs faster, just because it is fast. Non-optimal code is acceptable for very special cases and because a fix maybe would slow down more common situations. I've included an example for such a case. Okay, no fp code, but "-O2" and a align fix is faster than a big command-line. I found that ".align 5" is not optimal for all cases but a wrong ".align 4" may dramatically decrase the performance. Here the results: (make run) ---------------------------------------------------------------------- gcc -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti \ -o opt opt.c gcc -O2 -S -o - opt.c | \ sed -e 's/[ \t]*\.align[ \t]*5/\.align 4/g' > opt.s gcc -o opt_asm opt.s time ./opt 11.66user 0.00system 0:11.67elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (56major+13minor)pagefaults 0swaps time ./opt_asm 11.54user 0.00system 0:11.55elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (56major+13minor)pagefaults 0swaps rm opt.s ---------------------------------------------------------------------- ---------------------------------------------------------------------- /* opt.c */ #define E ++p; *p=0; do { #define L } while(++*p < 3); p--; int main() { unsigned loop[20], *p = loop; E E E E E E E E E E E E E E E E E E L L L L L L L L L L L L L L L L L L return 0; }; ---------------------------------------------------------------------- ---------------------------------------------------------------------- # Makefile T=opt all: $(T) $(T)_asm run: all time ./$(T) time ./$(T)_asm %.s:%.c ; gcc -O2 -S -o - $< | \ sed -e 's/[ \t]*\.align[ \t]*5/\.align 4/g' > $@ %:%.c ; gcc -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti \ -o $@ $< %_asm:%.s ; gcc -o $@ $< clean: rm -f $(T){,_asm,.o,.s,.c~} core ---------------------------------------------------------------------- -- Quant-X Service & Ph: (+43) 4212 6004-0 Consulting Ges.m.b.H. Fax: (+43) 4212 600420 http://www.quant-x.com Email: support@quant-x.com