| Opcode | Encoding | 16-bit | 32-bit | 64-bit | CPUID Feature Flag(s) | Description |
|---|---|---|---|---|---|---|
66 0F 2F /rCOMISD xmm1, xmm2/m32 | rm | Invalid | Valid | Valid | sse2 | Compare the lowest double-precision floating-point values from xmm1 and xmm2/m32. Set EFLAGS based on the result. |
VEX.LIG.66.0F.WIG 2F /rVCOMISD xmm1, xmm2/m32 | rm | Invalid | Valid | Valid | avx | Compare the lowest double-precision floating-point values from xmm1 and xmm2/m32. Set EFLAGS based on the result. |
EVEX.LLIG.66.0F.WIG 2F /rVCOMISD xmm1, xmm2/m32{sae} | erm | Invalid | Valid | Valid | avx512-f | Compare the lowest double-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)COMISD instruction compares a single double-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 COMISD(SimdF64 src1, SimdF64 src2)
{
_ = OrderedCompare(src1[0], src2[0]);
}
public void VCOMISD_Vex(SimdF64 src1, SimdF64 src2) =>
COMISD(src1, src2);
public void VCOMISD_Evex(SimdF64 src1, SimdF64 src2) =>
COMISD(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_sd(__m128 a, __m128 b)
int _mm_comile_sd(__m128 a, __m128 b)
int _mm_comieq_sd(__m128 a, __m128 b)
int _mm_comige_sd(__m128 a, __m128 b)
int _mm_comigt_sd(__m128 a, __m128 b)
int _mm_comineq_sd(__m128 a, __m128 b)
int _mm_comi_round_sd(__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.