Vol. 2A 3-143
INSTRUCTION SET REFERENCE, A-M
CMPSD—Compare Scalar Double-Precision Floating-Point Values
The greater-than relations not implemented in the processor require more than one
instruction to emulate in software and therefore should not be implemented as
pseudo-ops. (For these, the programmer should reverse the operands of the corre-
sponding less than relations and use move instructions to ensure that the mask is
moved to the correct destination register and that the source operand is left intact.)
In 64-bit mode, use of the REX.R prefix permits this instruction to access additional
registers (XMM8-XMM15).
Operation
CASE (COMPARISON PREDICATE) OF
0: OP ← EQ;
1: OP ← LT;
2: OP ← LE;
3: OP ← UNORD;
4: OP ← NEQ;
5: OP ← NLT;
6: OP ← NLE;
7: OP ← ORD;
DEFAULT: Reserved;
CMP0 ← DEST[63:0] OP SRC[63:0];
IF CMP0
= TRUE
THEN DEST[63:0] ← FFFFFFFFFFFFFFFFH;
ELSE DEST[63:0] ← 0000000000000000H; FI;
(* DEST[127:64] unchanged *)
Intel C/C++ Compiler Intrinsic Equivalents
CMPSD for equality __m128d _mm_cmpeq_sd(__m128d a, __m128d b)
CMPSD for less-than __m128d _mm_cmplt_sd(__m128d a, __m128d b)
CMPSD for less-than-or-equal __m128d _mm_cmple_sd(__m128d a, __m128d b)
CMPSD for greater-than __m128d _mm_cmpgt_sd(__m128d a, __m128d b)
CMPUNORDSD xmm1, xmm2 CMPSD xmm1,xmm2, 3
CMPNEQSD xmm1, xmm2 CMPSD xmm1,xmm2, 4
CMPNLTSD xmm1, xmm2 CMPSD xmm1,xmm2, 5
CMPNLESD xmm1, xmm2 CMPSD xmm1,xmm2, 6
CMPORDSD xmm1, xmm2 CMPSD xmm1,xmm2, 7
Table 3-10. Pseudo-Ops and CMPSD (Contd.)
Pseudo-Op Implementation