
Software Optimization Guide for AMD64 Processors | 25112 Rev. 3.06 September 2005 |
3.164-Bit Registers and Integer Arithmetic
Optimization
Use
Rationale
Using
Example 1
This code performs 64-bit addition using 32-bit registers:
;Add ECX:EBX to EDX:EAX, and place sum in EDX:EAX. 00000000 03 C3 add eax, ebx
00000002 13 D1 adc edx, ecx
Using
00000000 48 03 C3 add rax, rbx
Although the preceding instruction requires one additional byte for the REX prefix, it is still one byte shorter than the original code. More importantly, this instruction still has a latency of only one cycle, uses two fewer registers, and occupies only one decode slot.
60 | General | Chapter 3 |