User's Manual

22007E/0November 1999 AMD Athlon Processor x86 Code Optimization
Short Forms 127
11
General x86 Optimization
Guidelines
This chapter describes general code optimization techniques
specific to superscalar processors (that is, techniques common
to the AMD-K6
®
processor, AMD Athlon processor, and
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).
Short Forms
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.