1.

Which Is The Best Way To Write Loops?

Answer»

The best way is to write count down loops and compiler can generate better machine code for it than the count up loops. In count down at loop TERMINATION, it NEEDS to generate one INSTRUCTION (SUBS), which SUBTRACTS as well as check the zero flag, but in count up case it has to add and compare with a constant, which takes TWO instructions.

The best way is to write count down loops and compiler can generate better machine code for it than the count up loops. In count down at loop termination, it needs to generate one instruction (SUBS), which subtracts as well as check the zero flag, but in count up case it has to add and compare with a constant, which takes two instructions.



Discussion

No Comment Found