Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!cae780!leadsv!eps2!jon From: jon@eps2.UUCP Newsgroups: comp.sys.m68k Subject: Re: Incidentally ... Message-ID: <75@eps2.UUCP> Date: Tue, 7-Apr-87 00:59:09 EST Article-I.D.: eps2.75 Posted: Tue Apr 7 00:59:09 1987 Date-Received: Sat, 11-Apr-87 00:19:24 EST References: <362@sbcs.UUCP> <1466@ncr-sd.SanDiego.NCR.COM> <580@plx.UUCP> <6139@mimsy.UUCP> Distribution: comp Organization: Scumtronics Inc. Lines: 34 Summary: other constructs work too... In article <6139@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > In article <6134@mimsy.UUCP> I wrote: > >[use] while (--j >= 0) [rather than while (j--)] > > I poked around today and discovered that Sun's compiler, at least, > will turn > > register short j; /* but not `register int j' */ > while (--j != -1) > ... > > into a `dbra' loop. If you are willing to put machine dependent > source optimisations into your C code, this might be something to > consider (at least for inner loops). On this Sun-3/160 running 3.2, the compiler won't generate the dbra. However, the object code optimizer will. But the only way I know of to find this out is to adb the executable or a .o (I know I am not as clever as you, am I missing something? I didn't think you could get an optimized .s). One nice thing about the Green Hills compiler that Integraph uses was that you could look at optimized .s files. Interestingly enough, this incredibly old Alcyon C compiler I sometimes use generates the dbras. Another way to get the dbra instruction from the Sun optimizer is to use: register short i; for (i = 10; --i != -1;) /* the Alcyon compiler will do it too */ And as we all know, the dbra is especially important on the 68010 and 68012 because with the right instruction in the loop, you can get it into loop mode. Jonathan Hue DuPont Design Technologies/Via Visuals leadsv!eps2!jon