22007E/0 — November 1999

AMD Athlon™ Processor x86 Code Optimization

10

3DNow!™ and MMX™

Optimizations

This chapter describes 3DNow! and MMX code optimization techniques for the AMD Athlon™ processor. Guidelines are listed in order of importance. 3DNow! porting guidelines can be found in the 3DNow!™ Instruction Porting Guide, order# 22621.

Use 3DNow!™ Instructions

 

Unless accuracy requirements dictate otherwise, perform

 

floating-point computations using the 3DNow! instructions

TOP

instead of x87 instructions. The SIMD nature of 3DNow!

achieves twice the number of FLOPs that are achieved through

 

 

x87 instructions. 3DNow! instructions provide for a flat register

file instead of the stack-based approach of x87 instructions.

 

See the 3DNow!™ Technology Manual, order# 21928 for

 

information on instruction usage.

Use FEMMS Instruction

Though there is no penalty for switching between x87 FPU and 3DNow!/MMX instructions in the AMD Athlon processor, the FEMMS instruction should be used to ensure the same code also runs optimally on AMD-K6®family processors. The

Use 3DNow!™ Instructions

107

Page 123
Image 123
AMD x86 manual 3DNow! and MMX Optimizations, Use 3DNow! Instructions, Use Femms Instruction