Compare Ordered Scalar Single-Precision Floating-Point Value and Set EFLAGS

Encoding

EncodingOperand 1Operand 2Operand 3
rmn/aModRM.reg[r]ModRM.r/m[r]
ermtuple1-scalarModRM.reg[r]ModRM.r/m[r]

Description

The (V)COMISS instruction compares a single single-precision floating-point values from the two source operands. The flags are updated (per logic below) and the result discarded.

The result of the comparison is indicated using EFLAGS.ZF, EFLAGS.PF, and EFLAGS.CF in a way that does not match their names. The resulting values in the flags is detailed in this table:

Comparison ResultEFLAGS.ZFEFLAGS.PFEFLAGS.CF
Unordered1111
A < B001
A = B100
A > B000
  1. If either operand is NaN.

Operation

public void COMISS(SimdF32 src1, SimdF32 src2)
{
    _ = OrderedCompare(src1[0], src2[0]);
}

public void VCOMISS_Vex(SimdF32 src1, SimdF32 src2) =>
    COMISS(src1, src2);

public void VCOMISS_Evex(SimdF32 src1, SimdF32 src2) =>
    COMISS(src1, src2);

Flags Affected

CF (carry flag)
Set if the first source operand is less than the second, or if either operand is NaN. Cleared otherwise.
PF (parity flag)
Set if either operand is NaN. Cleared otherwise.
AF (auxiliary flag)
Cleared.
ZF (zero flag)
Set if both operands are equal, or if either operand is NaN. Cleared otherwise.
SF (sign flag)
Cleared.
OF (overflow flag)
Cleared.

Intrinsics

Exceptions

SIMD Floating-Point

#XM
  • #D - Denormal operand.
  • #I - Invalid operation.

Other Exceptions

VEX Encoded Form: See Type 3 Exception Conditions.
EVEX Encoded Form: See Type E3 Exception Conditions.

#UD
  • If VEX.vvvv is not 1111b.
  • If EVEX.vvvvv is not 11111b.