AMD Athlon Processor x86 Optimization Manual page 6

X86 code optimization
Table of Contents

Advertisement

AMD Athlon™ Processor x86 Code Optimization
7
Unrolling Loops. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Use Function Inlining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Avoid Address Generation Interlocks. . . . . . . . . . . . . . . . . . . . . . . . . 72
Use MOVZX and MOVSX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Minimize Pointer Arithmetic in Loops . . . . . . . . . . . . . . . . . . . . . . . . 73
Push Memory Data Carefully. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8
Replace Divides with Multiplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Use MMX™ Instructions for Integer-Only Work . . . . . . . . . . . . . . . . 83
Repeated String Instruction Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Use XOR Instruction to Clear Integer Registers . . . . . . . . . . . . . . . . 86
Efficient 64-Bit Integer Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Derivation of Multiplier Used for Integer Division
by Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
vi
Complete Loop Unrolling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Partial Loop Unrolling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Always Inline Functions with Fewer than 25 Machine
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Latency of Repeated String Instructions. . . . . . . . . . . . . . . . . 84
Guidelines for Repeated String Instructions . . . . . . . . . . . . . 84
Unsigned Derivation for Algorithm, Multiplier, and
Shift Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
22007E/0-November 1999
67
77
Contents

Advertisement

Table of Contents
loading

Table of Contents