| Opcode | Encoding | 16-bit | 32-bit | 64-bit | CPUID Feature Flag(s) | Description |
|---|---|---|---|---|---|---|
NP 0F 2F /rCOMISS xmm1, xmm2/m32 | rm | Invalid | Valid | Valid | sse | Compare the lowest single-precision floating-point values from xmm1 and xmm2/m32. Set EFLAGS based on the result. |
VEX.LIG.NP.0F.WIG 2F /rVCOMISS xmm1, xmm2/m32 | rm | Invalid | Valid | Valid | avx | Compare the lowest single-precision floating-point values from xmm1 and xmm2/m32. Set EFLAGS based on the result. |
EVEX.LLIG.NP.0F.WIG 2F /rVCOMISS xmm1, xmm2/m32{sae} | erm | Invalid | Valid | Valid | avx512-f | Compare the lowest single-precision floating-point values from xmm1 and xmm2/m32. Set EFLAGS based on the result. |
Encoding
| Encoding | Operand 1 | Operand 2 | Operand 3 |
|---|---|---|---|
rm | n/a | ModRM.reg[r] | ModRM.r/m[r] |
erm | tuple1-scalar | ModRM.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 Result | EFLAGS.ZF | EFLAGS.PF | EFLAGS.CF |
|---|---|---|---|
| Unordered1 | 1 | 1 | 1 |
| A < B | 0 | 0 | 1 |
| A = B | 1 | 0 | 0 |
| A > B | 0 | 0 | 0 |
- 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
int _mm_comilt_ss(__m128 a, __m128 b)
int _mm_comile_ss(__m128 a, __m128 b)
int _mm_comieq_ss(__m128 a, __m128 b)
int _mm_comige_ss(__m128 a, __m128 b)
int _mm_comigt_ss(__m128 a, __m128 b)
int _mm_comineq_ss(__m128 a, __m128 b)
int _mm_comi_round_ss(__m128 a, __m128 b, int predicate, int sae)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.vvvvis not1111b. - If
EVEX.vvvvvis not11111b.