Optimal for loop on the 68020.
Mike Bolotski
mikeb at coho.ee.ubc.ca
Wed Jun 7 11:27:44 AEST 1989
In article <5260014 at hplsla.HP.COM> jima at hplsla.HP.COM (Jim Adcock) writes:
>Below is your examples, redone with a null loop body, plus *my* favorite
>loop construct: for(i=COUNT; i--;).
This is my favorite loop, too. But if i is defined to be short, instead
of int, the following results (Sun3/260), gcc 1.35 -O -S.
Note: no -fstrength_reduce required.
main()
{
volatile int x;
short j;
for (j=5; j--; )
x = 0;
}
#NO_APP
gcc_compiled.:
.text
.even
.globl _main
_main:
link a6,#-4
moveq #5,d0
jra L2
L5:
clrl a6@(-4)
L2:
dbra d0,L5
unlk a6
rts
Mike Bolotski, Department of Electrical Engineering,
University of British Columbia, Vancouver, Canada
mikeb at ee.ubc.ca | mikeb%ee.ubc.ca at relay.ubc.ca
ee.ubc.ca!mikeb at uunet.uu.net | ...!ubc-vision!ee.ubc.ca!mikeb
More information about the Comp.lang.c
mailing list