Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!ogicse!cvedc!gssc!timr From: timr@gssc.UUCP (Tim Roberts) Newsgroups: comp.lang.c Subject: Re: micro-optimizing loops (was Help with casts) Message-ID: <6597@gssc.UUCP> Date: 26 Feb 91 20:44:05 GMT References: <10191@dog.ee.lbl.gov> <344@smds.UUCP> <10250@dog.ee.lbl.gov> Organization: Graphic Software Systems, Inc. Beaverton, Or. Lines: 29 In article <10250@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: >(with any luck this will die its own death after this...) Sorry. I just had to comment. In article <344@smds.UUCP> rh@smds.UUCP (Richard Harter) writes: >For reasons that are not clear to me many optimizing compilers will not >collapse the two machine instructions > dec r1 > bge 1$ >into the available single instruction to do the same thing. Perhaps >some of our compiler writers can explain this to us. From the Intel i486 Programmers Reference Manual and the Department of Counterintuitive Advice: o The LOOP instruction takes two more clock cycles to execute than the equivalent decrement and conditional jump instructions. Even more strange: o The JECXZ (jump on ECX=0) instruction takes one more clock cycle to execute than the equivalent compare and conditional jump instructions. -- timr@gssc.gss.com Tim N Roberts, CCP Graphic Software Systems Beaverton, OR This is a very long palindrome. .emordnilap gnol yrev a si sihT