
Chapter 4: 128-Bit Media and Scientific Programming
223
24593—Rev. 3.09—September 2003
AMD 64-Bit Technology
decrement rSP by 16 for each 128-bit XMM register parameter
stored on the stack. Likewise, to load a 128-bit XMM register
from the stack, software should increment rSP by 16 after the
load. There is a choice of MOV
x
instructions designed for
aligned and unaligned moves, as described in “Data Transfer”
on page 162 and “Data Transfer” on page 187.
The processor does not check the data type of instruction
operands prior to executing instructions. It only checks them at
the point of execution. For example, if the processor executes
an arithmetic instruction that takes double-precision operands
but is provided with single-precision operands by MOV
x
instructions, the processor will first convert the operands from
single precision to double precision prior to executing the
arithmetic operation, and the result will be correct. However,
the required conversion may cause degradation of performance.
Because of this possibility of data-type mismatching between
MOV
x
instructions used to pass parameters and the
instructions in the called procedure that subsequently operate
on the moved data, the calling procedure should save its own
state prior to the call. The called procedure cannot determine
the caller’s data types, and thus it cannot optimize its choice of
instructions for storing a caller’s state.
For further information, see the software optimization
documentation for particular hardware implementations.
4.11.3
Accessing
Operands in MMX
Registers
Software may freely mix 128-bit media instructions (integer or
floating-point) with 64-bit media instructions (integer or
floating-point) and general-purpose instructions in a single
procedure. There are no restrictions on transitioning from 128-
bit media procedures to x87 procedures, except when a 128-bit
media procedure accesses an MMX register by means of a data-
transfer or data-conversion instruction.
In such cases, software should separate such procedures or
dynamic link libraries (DLLs) from x87 floating-point
procedures or DLLs by clearing the MMX state with the EMMS
instruction, as described in “Exit Media State” on page 247. For
further details, see “Mixing Media Code with x87 Code” on
page 278.