Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!alberta!ubc-cs!fs1!coho.ee.ubc.ca!mikeb From: mikeb@coho.ee.ubc.ca (Mike Bolotski) Newsgroups: comp.lang.c Subject: Re: Optimal for loop on the 68020. Message-ID: <304@fs1.ee.ubc.ca> Date: 7 Jun 89 01:27:44 GMT References: <11993@well.UUCP> <5260014@hplsla.HP.COM> Sender: news@fs1.ee.ubc.ca Reply-To: mikeb@ee.ubc.ca (Mike Bolotski) Organization: Dept. of Electrical Engineering University of B.C. Lines: 39 In article <5260014@hplsla.HP.COM> jima@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@ee.ubc.ca | mikeb%ee.ubc.ca@relay.ubc.ca ee.ubc.ca!mikeb@uunet.uu.net | ...!ubc-vision!ee.ubc.ca!mikeb