FPU Flags Affected

The floating-point instruction pages have a section called "FPU Flags Affected," which tells how each instruction can affect the four condition code bits of the FPU status word. These pages contain a condition code information table similar to the following:

┌──┬──┬──┬──┐
│C0│C1│C2│C3│
├──┼──┼──┼──┤
│? │* │? │? │
└──┴──┴──┴──┘

The first row of the table lists the names of the floating-point condition code flags. The entries in the second row are filled in according to how the flag is affected by the instruction:

┌────────┬────────────────────────────────┐
│VALUE   │MEANING                         │
├────────┼────────────────────────────────┤
│<blank> │Instruction does not affect flag│
├────────┼────────────────────────────────┤
│0       │Instruction clears the flag     │
├────────┼────────────────────────────────┤
│1       │Instruction sets the flag       │
├────────┼────────────────────────────────┤
│?       │Instruction's effect on the flag│
│        │is undefined                    │
├────────┼────────────────────────────────┤
│*       │Instruction modifies the flag   │
│        │(either sets or clears depending│
│        │on operands)                    │
└────────┴────────────────────────────────┘

The four FPU condition code bits (C0, C1, C2, and C3) are similar to the flags in a CPU; the processor updates these bits to reflect the outcome of arithmetic operations. The effect of these instructions on the condition code bits is summarized in the following table:

Condition Code Interpretation ┌─────────────────────────┬─────────────┬────────────┬────────────┬────────────┐
│ INSTRUCTION │ C0 │ C3 │ C2 │ C1 │
├─────────────────────────┼─────────────┴────────────┼────────────┼────────────┤
│ FCOM, FCOMP, FCOMPP, │ Result of Comparison │ Operands │ Zero or │
│ FTST, FUCOMPP, FICOM, │ │ is not │ O/U# │
│ FICOMP │ │ Comparable │ │
├─────────────────────────┼──────────────────────────┴────────────┼────────────┤
│ FXAM │ Operand class │ Sign or │
│ │ │ O/U# │
├─────────────────────────┼─────────────┬────────────┬────────────┼────────────┤
│ FPREM, FPREM1 │ Q2 │ Q1 │ 0=reduction│ Q0 or O/U# │
│ │ │ │ complete │ │
│ │ │ │ │ │
│ │ │ │ 1=reduction│ │
│ │ │ │ incomplete │ │
├─────────────────────────┼─────────────┴────────────┴────────────┼────────────┤
│ FIST, FBSTP, FRINDINT, │ UNDEFINED │ Roundup or │
│ FST, FSTP, FADD, FMUL, │ │ O/U# │
│ FDIV, FDIVR, FSUB, │ │ │
│ FSUBR, FSCALE, FSQRT, │ │ │
│ FPATAN, F2XM1, FYL2X, │ │ │
│ FYL2XP1 │ │ │
├─────────────────────────┼──────────────────────────┬────────────┼────────────┤
│ FPTAN, FSIN, FCOS, │ UNDEFINED │ 0=reduction│ Roundup or │
│ FSINCOS │ │ complete │ O/U# │
│ │ │ │ (UNDEFINED │
│ │ │ 1=reduction│ if C2=1) │
│ │ │ incomplete │ │
├─────────────────────────┼──────────────────────────┴────────────┼────────────┤
│ FCHS, FABS, FXCH, │ UNDEFINED │ Zero or │
│ FINCSTP, FDECSTP, Con- │ │ O/U# │
│ stant Loads, FXTRACT, │ │ │
│ FLD, FILD, FBLD, FSTP │ │ │
│ (ext. real) │ │ │
├─────────────────────────┼───────────────────────────────────────┴────────────┤
│ FLDENV, FRSTOR │ Each bit loaded from memory │
├─────────────────────────┼────────────────────────────────────────────────────┤
│ FLDCW, FSTENV, FSTCW, │ UNDEFINED │
│ FSTSW, FCLEX │ │
├─────────────────────────┼─────────────┬────────────┬────────────┬────────────┤
│ FINIT, FSAVE │ Zero │ Zero │ Zero │ Zero │
└─────────────────────────┴─────────────┴────────────┴────────────┴────────────┘

NOTES: