Intel 253666-024US Manuel D’Utilisation

Page de 760
Vol. 2A 3-309
INSTRUCTION SET REFERENCE, A-M
FCOMI/FCOMIP/ FUCOMI/FUCOMIP—Compare Floating Point Values and Set EFLAGS
FCOMI/FCOMIP/
 
FUCOMI/FUCOMIP—Compare Floating Point Values and 
Set EFLAGS
Description
Performs an unordered comparison of the contents of registers ST(0) and ST(i) and 
sets the status flags ZF, PF, and CF in the EFLAGS register according to the results 
(see the table below). The sign of zero is ignored for comparisons, 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 FUCOMI/FUCOMIP instructions 
perform the same operations as the FCOMI/FCOMIP instructions. The only difference 
is that the FUCOMI/FUCOMIP instructions raise the invalid-arithmetic-operand 
exception (#IA) only when either or both operands are an SNaN or are in an unsup-
ported format; QNaNs cause the condition code flags to be set to unordered, but do 
not cause an exception to be generated. The FCOMI/FCOMIP 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.
Opcode
Instruction
64-Bit 
Mode
Compat/
Leg Mode
Description
DB F0+i
FCOMI ST, ST(i)
Valid
Valid
Compare ST(0) with ST(i) and set status 
flags accordingly.
DF F0+i
FCOMIP ST, ST(i)
Valid
Valid
Compare ST(0) with ST(i), set status flags 
accordingly, and pop register stack.
DB E8+i
FUCOMI ST, ST(i)
Valid
Valid
Compare ST(0) with ST(i), check for 
ordered values, and set status flags 
accordingly.
DF E8+i
FUCOMIP ST, ST(i) Valid
Valid
Compare ST(0) with ST(i), check for 
ordered values, set status flags 
accordingly, and pop register stack.
Table 3-27.  FCOMI/FCOMIP/ FUCOMI/FUCOMIP Results
Comparison Results*
ZF
PF
CF
ST0 > ST(i)
0
0
0
ST0 < ST(i)
0
0
1
ST0 = ST(i)
1
0
0
Unordered**
1
1
1
NOTES:
* See the IA-32 Architecture Compatibility section below.
** Flags not set if unmasked invalid-arithmetic-operand (#IA) exception is generated.