micro-optimizing loops (was Help with casts)
Tim Roberts
timr at gssc.UUCP
Wed Feb 27 07:44:05 AEST 1991
In article <10250 at dog.ee.lbl.gov> torek at 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 at smds.UUCP> rh at 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 at gssc.gss.com Tim N Roberts, CCP Graphic Software Systems
Beaverton, OR
This is a very long palindrome. .emordnilap gnol yrev a si sihT
More information about the Comp.lang.c
mailing list