From: David Gow Date: Fri, 4 Jul 2014 13:47:33 +0000 (+0800) Subject: Use the lea instruction to reduce number of "inc"s X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=35e78b378435e37ffdb6e53a97f6fa0998999f67;p=ipdf%2Fcode.git Use the lea instruction to reduce number of "inc"s --- diff --git a/src/tests/add_digits.s b/src/tests/add_digits.s index 09d4ea3..39f4af9 100644 --- a/src/tests/add_digits.s +++ b/src/tests/add_digits.s @@ -16,23 +16,9 @@ add_digits: jz end_loop # We are done # Move to next element in the first array - inc %rdi - inc %rdi - inc %rdi - inc %rdi - inc %rdi - inc %rdi - inc %rdi - inc %rdi + leaq 8(,%rdi,1), %rdi # Move to next element in the second array - inc %rsi - inc %rsi - inc %rsi - inc %rsi - inc %rsi - inc %rsi - inc %rsi - inc %rsi + leaq 8(,%rsi,1), %rsi jmp loop # Repeat end_loop: movq $0, %rax