3-254
INSTRUCTION SET REFERENCE
FSTSW/FNSTSWStore Status Word
NOTE:
* Refer to Intel Architecture Compatibility below.
Description
These instructions store the current value of the FPU status word in the destination location. The
destination operand can be either a two-byte memory location or the AX register. The FSTSW
instruction checks for and handles pending unmasked floating-point exceptions before storing
the status word; the FNSTSW instruction does not.
The FNSTSW AX form of the instruction is used primarily in conditional branching (for
instance, after an FPU comparison instruction or an FPREM, FPREM1, or FXAM instruction),
where the direction of the branch depends on the state of the FPU condition code flags. Refer to
Section 7.3.3., Branching and Conditional Moves on FPU Condition Codes in Chapter 7,
Floating-Point Unit of the Intel Architecture Software Developers Manual, Volume 1. This
instruction can also be used to invoke exception handlers (by examining the exception flags) in
environments that do not use interrupts. When the FNSTSW AX instruction is executed, the AX
register is updated before the processor executes any further instructions. The status stored in
the AX register is thus guaranteed to be from the completion of the prior FPU instruction.
Intel Architecture Compatibility
When operating a Pentium
®
or Intel486 processor in MS-DOS compatibility mode, it is
possible (under unusual circumstances) for an FNSTSW instruction to be interrupted prior to
being executed to handle a pending FPU exception. Refer to Section E.2.1.3, No-Wait FPU
Instructions Can Get FPU Interrupt in Window in Appendix E, Guidelines for Writing FPU
Exception Handlers of the Intel Architecture Software Developers Manual, Volume 1, for a
description of these circumstances. An FNSTSW instruction cannot be interrupted in this way
on a Pentium
®
Pro processor.
On a Pentium
®
III processor, the FSTSW/FNSTSW instructions operate the same as on a
Pentium
®
II processor. They have no effect on the Pentium
®
III processor SIMD floating-point
functional unit or control/status register.
Opcode
Instruction
Description
9B DD /7
FSTSW m2byte
Store FPU status word at m2byte after checking for
pending unmasked floating-point exceptions.
9B DF E0
FSTSW AX
Store FPU status word in AX register after checking for
pending unmasked floating-point exceptions.
DD /7
FNSTSW
*
m2byteStore FPU status word at m2byte without checking for
pending unmasked floating-point exceptions.
DF E0
FNSTSW
*
AX
Store FPU status word in AX register without checking for
pending unmasked floating-point exceptions.