22007E/0—November 1999
Short Forms
Short Forms
General x86 Optimization
Guidelines
This chapter describes general code optimization techniques
specific to superscalar processors (that is, techniques common
®
to the AMD-K6
®
Pentium
family processors). In general, all optimization
techniques used for the AMD-K6 processor, Pentium, and
Pentium Pro processors either improve the performance of the
AMD Athlon processor or are not required and have a neutral
effect (usually due to fewer coding restrictions with the
AMD Athlon processor).
Use shorter forms of instructions to increase the effective
number of instructions that can be examined for decoding at
any one time. Use 8-bit displacements and jump offsets where
possible.
Example 1 (Avoid):
CMP
REG, 0
Example 2 (Preferred):
TEST
REG, REG
Although both of these instructions have an execute latency of
one, fewer opcode bytes need to be examined by the decoders
for the TEST instruction.
AMD Athlon™ Processor x86 Code Optimization
processor, AMD Athlon™ processor, and
11
127