
Software Optimization Guide for AMD64 Processors | 25112 Rev. 3.06 September 2005 |
4.6Short Instruction Encodings
Optimization
Use instruction forms with shorter encodings rather than those with longer encodings. For example, use
Application
This optimization applies to:
•
•
Rationale
Using shorter instructions increases the number of instructions that can fit into the L1 instruction cache and increases the average decode rate.
Example
Avoid the use of instructions with longer encodings, such as those shown here:
81 | C0 | 78 | 56 | 34 | 12 | add eax, | 12345678h | ; | ||
81 | C3 | FB FF FF FF | add ebx, | ; | immediate value | |||||
0F | 84 | 05 | 00 | 00 | 00 | jz label1 | ; | opcode, | ||
Instead, choose instructions with shorter encodings, like these:
05 | 78 | 56 | 34 12 | add | eax, 12345678h | ; | |
83 | C3 | FB |
| add | ebx, | ; | |
74 | 05 |
|
| jz | label1 | ; | |
80 | Chapter 4 |