Vol. 3A 12-3
INTEL
®
MMX
™
TECHNOLOGY SYSTEM PROGRAMMING
12.2.1
Effect of MMX, x87 FPU, FXSAVE, and FXRSTOR
Instructions on the x87 FPU Tag Word
Table 12-3 summarizes the effect of MMX and x87 FPU instructions and the FXSAVE and FXRSTOR instructions on
the tags in the x87 FPU tag word and the corresponding tags in an image of the tag word stored in memory.
The values in the fields of the x87 FPU tag word do not affect the contents of the MMX registers or the execution of
MMX instructions. However, the MMX instructions do modify the contents of the x87 FPU tag word, as is described
in Section 12.2, “The MMX State and MMX Register Aliasing.” These modifications may affect the operation of the
x87 FPU when executing x87 FPU instructions, if the x87 FPU state is not initialized or restored prior to beginning
x87 FPU instruction execution.
Note that the FSAVE, FXSAVE, and FSTENV instructions (which save x87 FPU state information) read the x87 FPU
tag register and contents of each of the floating-point registers, determine the actual tag values for each register
(empty, nonzero, zero, or special), and store the updated tag word in memory. After executing these instructions,
all the tags in the x87 FPU tag word are set to empty (11B). Likewise, the EMMS instruction clears MMX state from
the MMX/floating-point registers by setting all the tags in the x87 FPU tag word to 11B.
12.3 SAVING
AND
RESTORING
THE MMX STATE AND REGISTERS
Because the MMX registers are aliased to the x87 FPU data registers, the MMX state can be saved to memory and
restored from memory as follows:
Table 12-2. Effects of MMX Instructions on x87 FPU State
MMX Instruction
Type
x87 FPU Tag
Word
TOS Field of x87
FPU Status Word
Other x87 FPU
Registers
Bits 64 Through 79
of x87 FPU Data
Registers
Bits 0 Through 63
of x87 FPU Data
Registers
Read from MMX
register
All tags set to 00B
(Valid)
000B
Unchanged
Unchanged
Unchanged
Write to MMX
register
All tags set to 00B
(Valid)
000B
Unchanged
Set to all 1s
Overwritten with
MMX data
EMMS
All fields set to
11B (Empty)
000B
Unchanged
Unchanged
Unchanged
Table 12-3. Effect of the MMX
,
x87 FPU, and FXSAVE/FXRSTOR Instructions on the x87 FPU Tag Word
Instruction
Type
Instruction
x87 FPU Tag Word
Image of x87 FPU Tag Word Stored in
Memory
MMX
All (except EMMS)
All tags are set to 00B (valid).
Not affected.
MMX
EMMS
All tags are set to 11B (empty).
Not affected.
x87 FPU
All (except FSAVE,
FSTENV, FRSTOR,
FLDENV)
Tag for modified floating-point register is
set to 00B or 11B.
Not affected.
x87 FPU and
FXSAVE
FSAVE, FSTENV, FXSAVE
Tags and register values are read and
interpreted; then all tags are set to 11B.
Tags are set according to the actual
values in the floating-point registers;
that is, empty registers are marked 11B
and valid registers are marked 00B
(nonzero), 01B (zero), or 10B (special).
x87 FPU and
FXRSTOR
FRSTOR, FLDENV,
FXRSTOR
All tags marked 11B in memory are set
to 11B; all other tags are set according
to the value in the corresponding
floating-point register: 00B (nonzero),
01B (zero), or 10B (special).
Tags are read and interpreted, but not
modified.