beautypg.com

Intel 253666-024US User Manual

Page 173

background image

Vol. 2A 3-127

INSTRUCTION SET REFERENCE, A-M

CMPPD—Compare Packed Double-Precision Floating-Point Values

The unordered relationship is true when at least one of the two source operands
being compared is a NaN; the ordered relationship is true when neither source
operand is a NaN.
A subsequent computational instruction that uses the mask result in the destination
operand as an input operand will not generate an exception, because a mask of all 0s
corresponds to a floating-point value of +0.0 and a mask of all 1s corresponds to a

QNaN.
Note that the processor does not implement the greater-than, greater-than-or-
equal, not-greater-than, and not-greater-than-or-equal relations. These compari-
sons can be made either by using the inverse relationship (that is, use the “not-less-
than-or-equal” to make a “greater-than” comparison) or by using software emula-
tion. When using software emulation, the program must swap the operands (copying
registers when necessary to protect the data that will now be in the destination), and
then perform the compare using a different predicate. The predicate to be used for
these emulations is listed in Table 3-7 under the heading Emulation.
Compilers and assemblers may implement the following two-operand pseudo-ops in
addition to the three-operand CMPPD instruction. See Table 3-7.

:

NLE

110B

Not-less-than-or-

equal

NOT(A

B)

True

Yes

Not-greater-than

NOT(A

>

B)

Swap

Operands,

Use NLT

True

Yes

Not-greater-than-

or-equal

NOT(A

B)

Swap

Operands,

Use NLE

True

Yes

ORD

111B

Ordered

A , B

=

Ordered

False

No

Table 3-8. Pseudo-Op and CMPPD Implementation

Pseudo-Op

CMPPD Implementation

CMPEQPD xmm1, xmm2

CMPPD xmm1, xmm2, 0

CMPLTPD xmm1, xmm2

CMPPD xmm1, xmm2, 1

CMPLEPD xmm1, xmm2

CMPPD xmm1, xmm2, 2

CMPUNORDPD xmm1, xmm2

CMPPD xmm1, xmm2, 3

CMPNEQPD xmm1, xmm2

CMPPD xmm1, xmm2, 4

CMPNLTPD xmm1, xmm2

CMPPD xmm1, xmm2, 5

Table 3-7. Comparison Predicate for CMPPD and CMPPS Instructions (Contd.)

Predi-

cate

imm8

Encod-

ing

Description

Relation where:

A Is 1st Operand

B Is 2nd

Operand

Emulation Result if

NaN

Operand

QNaN

Oper-and

Signals

Invalid