AMD amd64 architecture User Manual

Page of 336
64-Bit Media Programming
199
24592—Rev. 3.15—November 2009
AMD64 Technology
5.3.6 Floating-Point (3DNow!™) Vector Operations
Floating-point vector instructions using the MMX registers were introduced by AMD with the
3DNow! technology. These instructions take 64-bit vector operands consisting of two 32-bit single-
precision floating-point numbers, shown as FP single in Figure 5-6.
Figure 5-6.
Floating-Point (3DNow!™ Instruction) Operations
The AMD64 architecture’s 3DNow! floating-point instructions provide a unique advantage over
legacy x87 floating-point instructions: They allow integer and floating-point instructions to be
intermixed in the same procedure, using only the MMX registers. This avoids the need to switch
between integer MMX procedures and x87 floating-point procedures—a switch that may involve
time-consuming state saves and restores—while at the same time leaving the 128-bit XMM register
resources free for other applications.
The 3DNow! instructions allow applications such as 3D graphics to accelerate front-end geometry,
clipping, and lighting calculations. Picture and pixel data are typically integer data types, although
both integer and floating-point instructions are often required to operate completely on the data. For
example, software can change the viewing perspective of a 3D scene through transformation matrices
by using floating-point instructions in the same procedure that contains integer operations on other
aspects of the graphics data.
3DNow! programs typically perform better than x87 floating-point code, because the MMX register
file is flat rather than stack-oriented and because 3DNow! instructions can operate on twice as many
operands as x87 floating-point instructions. This ability to operate in parallel on twice as many
floating-point values in the same register space often makes it possible to remove local temporary
variables in 3DNow! code that would otherwise be needed in x87 floating-point code.
63
31
0
32
FP single FP single
63
31
0
32
FP single FP single
63
31
0
32
FP single FP single
513-124.eps
63
0
63
0
op
op