Intel 253666-024US Computer Hardware User Manual


 
3-408 Vol. 2A FUCOM/FUCOMP/FUCOMPP—Unordered Compare Floating Point Values
INSTRUCTION SET REFERENCE, A-M
FUCOM/FUCOMP/FUCOMPP—Unordered Compare Floating Point Values
Description
Performs an unordered comparison of the contents of register ST(0) and ST(i) and
sets condition code flags C0, C2, and C3 in the FPU status word according to the
results (see the table below). If no operand is specified, the contents of registers
ST(0) and ST(1) are compared. The sign of zero is ignored, so that –0.0 is equal to
+0.0.
An unordered comparison checks the class of the numbers being compared (see
“FXAM—ExamineModR/M” in this chapter). The FUCOM/FUCOMP/FUCOMPP instruc-
tions perform the same operations as the FCOM/FCOMP/FCOMPP instructions. The
only difference is that the FUCOM/FUCOMP/FUCOMPP instructions raise the invalid-
arithmetic-operand exception (#IA) only when either or both operands are an SNaN
or are in an unsupported format; QNaNs cause the condition code flags to be set to
unordered, but do not cause an exception to be generated. The
FCOM/FCOMP/FCOMPP instructions raise an invalid-operation exception when either
or both of the operands are a NaN value of any kind or are in an unsupported format.
As with the FCOM/FCOMP/FCOMPP instructions, if the operation results in an invalid-
arithmetic-operand exception being raised, the condition code flags are set only if the
exception is masked.
Opcode Instruction 64-Bit
Mode
Compat/
Leg Mode
Description
DD E0+i FUCOM ST(i) Valid Valid Compare ST(0) with ST(i).
DD E1 FUCOM Valid Valid Compare ST(0) with ST(1).
DD E8+i FUCOMP ST(i) Valid Valid Compare ST(0) with ST(i) and pop
register stack.
DD E9 FUCOMP Valid Valid Compare ST(0) with ST(1) and pop
register stack.
DA E9 FUCOMPP Valid Valid Compare ST(0) with ST(1) and pop
register stack twice.
Table 3-46. FUCOM/FUCOMP/FUCOMPP Results
Comparison Results* C3 C2 C0
ST0 > ST(i) 0 0 0
ST0 < ST(i) 0 0 1
ST0 = ST(i) 1 0 0
Unordered 1 1 1
NOTES:
* Flags not set if unmasked invalid-arithmetic-operand (#IA) exception is generated.