Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Quant-X Alpha Linux Support <stefan@sime.com>
To: axp-list@redhat.com
Cc: rth@cygnus.com
Subject: Re: flags for egcs on alpha
Date: Thu, 16 Jul 1998 17:26:49 +0200	[thread overview]
Message-ID: <199807161526.RAA09614@stefan.sime.com> (raw)
In-Reply-To: <19980716032019.A6773@kg1.ping.de> (message from Kurt Garloff on Thu, 16 Jul 1998 03:20:19 +0200)

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


      reply	other threads:[~1998-07-16 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-15 21:47 flags for egcs on alpha Jon Harman
1998-07-16  0:38 ` Richard Henderson
1998-07-16  1:20   ` Kurt Garloff
1998-07-16 15:26     ` Quant-X Alpha Linux Support [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox