Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: Lemmings - a tutorial Part V (last) Message-ID: <20438@cbmvax.commodore.com> Date: 7 Apr 91 06:39:57 GMT References: <1991Apr2.002631.22799@mintaka.lcs.mit.edu> <20243@cbmvax.commodore.com> <1991Apr6.225956.21886@watdragon.waterloo.edu> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 35 In article <1991Apr6.225956.21886@watdragon.waterloo.edu> ccplumb@rose.uwaterloo.ca (Colin Plumb) writes: >> It does use a2/a3 instead of a0/a1. However it beats the GNU >>version slightly by jumping to the test instead having two copies of it. > >We must disagree on what is good optimisation... I consider gcc's duplication >of the test to be a feature, and SAS's jump-to-the-end a missed optimisation. >It's clearly faster the way gcc does it. (Gcc saves one untaken branch >in the no-execute case, and one taken branch in the execute case.) Note that I typically compile with -O -ms (optimize, space before speed). However, you're probably right that it does the same thing with -mt (time before space), so I'll make sure it's in the next SAS release (I alpha/beta test for them, and often suggest optimizations after reading OMD dumps - I've written full RISC code-reorganizers in the past, and am quite up on my assembler). My latest optimization idea, specifically oriented at tags: You often push a lot of tags and data on the stack and call xxxTags(). Because of an annoying (in hindsight) decision by the person writing utility library, most of these values are $80xxxxxx, and are being pushed by move.l #xxxxxxxx,-(a7). However, most of these values are within a small number of the "base" of the tags for that routine. The compiler could notice it's pushing a bunch of values that are within a range of 64K, and load an address register with a value in that range, and then use pea xxxx(an) (one would normally be pea (an)). Unfortunately, (an)+ and -(an) aren't allowed for pea, or you could do even better in certain cases. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup Disclaimer: Nothing I say is anything other than my personal opinion. Thus spake the Master Ninjei: "To program a million-line operating system is easy, to change a man's temperament is more difficult." (From "The Zen of Programming") ;-)