Comparisons

Microsoft Specific

Each comparison intrinsic performs a comparison of a and b. For the packed form, the two double-precision, floating-point values of a and b are compared, and a 128-bit mask is returned. For the scalar form, the lower double-precision, floating-point values of a and b are compared, and a 64-bit mask is returned; the upper double-precision, floating-point value is passed through from a. The mask is set to 0xffffffffffffffff for each element where the comparison is true and 0x0 where the comparison is false. The r following the instruction name indicates that the operands to the instruction are reversed in the actual implementation.

The comparison intrinsics are listed in the following table, followed by detailed descriptions.

SSE2 intrinsics use the __m128, __m128i, and __m128d data types, which are not supported on Itanium Processor Family (IPF) processors. Any SSE2 intrinsics that use the __m64 data type are not supported on x64 processors.

The emmintrin.h header file contains the declarations for the SSE2 instructions intrinsics.

Comparison Intrinsics

Intrinsic name

Corresponding instruction

Compare for

_mm_cmpeq_pd

CMPEQPD

Equality

_mm_cmplt_pd

CMPLTPD

Less than

_mm_cmple_pd

CMPLEPD

Less than or equal

_mm_cmpgt_pd

CMPLTPDr

Greater than

_mm_cmpge_pd

CMPLEPDr

Greater than or equal

_mm_cmpord_pd

CMPORDPD

Ordered

_mm_cmpunord_pd

CMPUNORDPD

Unordered

_mm_cmpneq_pd

CMPNEQPD

Inequality

_mm_cmpnlt_pd

CMPNLTPD

Not less than

_mm_cmpnle_pd

CMPNLEPD

Not less than or equal

_mm_cmpngt_pd

CMPNLTPDr

Not greater than

_mm_cmpnge_pd

CMPLEPDr

Not greater than or equal

_mm_cmpeq_sd

CMPEQSD

Equality

_mm_cmplt_sd

CMPLTSD

Less than

_mm_cmple_sd

CMPLESD

Less than or equal

_mm_cmpgt_sd

CMPLTSDr

Greater than

_mm_cmpge_sd

CMPLESDr

Greater than or equal

_mm_cmpord_sd

CMPORDSD

Ordered

_mm_cmpunord_sd

CMPUNORDSD

Unordered

_mm_cmpneq_sd

CMPNEQSD

Inequality

_mm_cmpnlt_sd

CMPNLTSD

Not less than

_mm_cmpnle_sd

CMPNLESD

Not less than or equal

_mm_cmpngt_sd

CMPNLTSDr

Not greater than

_mm_cmpnge_sd

CMPNLESDR

Not greater than or equal

_mm_comieq_sd

COMISD

Equality

_mm_comilt_sd

COMISD

Less than

_mm_comile_sd

COMISD

Less than or equal

_mm_comigt_sd

COMISD

Greater than

_mm_comige_sd

COMISD

Greater than or equal

_mm_comineq_sd

COMISD

Not equal

_mm_ucomieq_sd

UCOMISD

Equality

_mm_ucomilt_sd

UCOMISD

Less than

_mm_ucomile_sd

UCOMISD

Less than or equal

_mm_ucomigt_sd

UCOMISD

Greater than

_mm_ucomige_sd

UCOMISD

Greater than or equal

_mm_ucomineq_sd

UCOMISD

Not equal

For an explanation of the syntax used in code samples in this topic, see Floating-Point Intrinsics Using Streaming SIMD Extensions.

See Also

Concepts

Floating-Point Intrinsics Using Streaming SIMD Extensions 2 Instructions