Floating-point Comparison Operations for Streaming SIMD Extensions 2

Each comparison intrinsic performs a comparison of a and b. For the packed form, the two DP FP values of a and b are compared, and a 128-bit mask is returned. For the scalar form, the lower DP FP values of a and b are compared, and a 64-bit mask is returned; the upper DP FP 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 for the Streaming SIMD Extensions 2 (SSE2) are listed in the following table followed by detailed descriptions.

The prototypes for SSE2 intrinsics are in the emmintrin.h header file.

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

__m128d _mm_cmpeq_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for equality.
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmplt_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a less than b.
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffffffffffff : 0x0

___m128d _mm_cmple_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a less than or equal to b.
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpgt_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a greater than b.
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpge_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a greater than or equal to b.
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpord_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for ordered.
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 ord b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpunord_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for unordered.
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 unord b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpneq_pd ( __m128d a, __m128d b)

Compares the two DP FP values of a and b for inequality.
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpnlt_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a not less than b.
r0 := !(a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := !(a1 < b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpnle_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a not less than or equal to b.
r0 := !(a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := !(a1 <= b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpngt_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a not greater than b.
r0 := !(a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := !(a1 > b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpnge_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for a not greater than or equal to b.
r0 := !(a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := !(a1 >= b1) ? 0xffffffffffffffff : 0x0

__m128d _mm_cmpeq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for equality. The upper DP FP value is passed through from a.
r0 := (a0 == b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmplt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than b. The upper DP FP value is passed through from a.
r0 := (a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := i1

__m128d _mm_cmple_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than or equal to b. The upper DP FP value is passed through from a.
r0 := (a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpgt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than b. The upper DP FP value is passed through from a.
r0 := (a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpge_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than or equal to b. The upper DP FP value is passed through from a.
r0 := (a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpord_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for ordered. The upper DP FP value is passed through from a.
r0 := (a0 ord b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpunord_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for unordered. The upper DP FP value is passed through from a.
r0 := (a0 unord b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpneq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for inequality. The upper DP FP value is passed through from a.
r0 := (a0 != b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpnlt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not less than b. The upper DP FP value is passed through from a.
r0 := !(a0 < b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpnle_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not less than or equal to b. The upper DP FP value is passed through from a.
r0 := !(a0 <= b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpngt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not greater than b. The upper DP FP value is passed through from a.
r0 := !(a0 > b0) ? 0xffffffffffffffff : 0x0
r1 := a1

__m128d _mm_cmpnge_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not greater than or equal to b. The upper DP FP value is passed through from a.
r0 := !(a0 >= b0) ? 0xffffffffffffffff : 0x0
r1 := a1

int _mm_comieq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise 0 is returned.
r := (a0 == b0) ? 0x1 : 0x0

int _mm_comilt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than b. If a is less than b, 1 is returned. Otherwise 0 is returned.
r := (a0 < b0) ? 0x1 : 0x0

int _mm_comile_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than or equal to b. If a is less than or equal to b, 1 is returned. Otherwise 0 is returned.
r := (a0 <= b0) ? 0x1 : 0x0

int _mm_comigt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than b. If a is greater than b are equal, 1 is returned. Otherwise 0 is returned.
r := (a0 > b0) ? 0x1 : 0x0

int _mm_comige_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than or equal to b. If a is greater than or equal to b, 1 is returned. Otherwise 0 is returned.
r := (a0 >= b0) ? 0x1 : 0x0

int _mm_comineq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not equal to b. If a and b are not equal, 1 is returned. Otherwise 0 is returned.
r := (a0 != b0) ? 0x1 : 0x0

int _mm_ucomieq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise 0 is returned.
r := (a0 == b0) ? 0x1 : 0x0

int _mm_ucomilt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than b. If a is less than b, 1 is returned. Otherwise 0 is returned.
r := (a0 < b0) ? 0x1 : 0x0

int _mm_ucomile_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a less than or equal to b. If a is less than or equal to b, 1 is returned. Otherwise 0 is returned.
r := (a0 <= b0) ? 0x1 : 0x0

int _mm_ucomigt_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than b. If a is greater than b are equal, 1 is returned. Otherwise 0 is returned.
r := (a0 > b0) ? 0x1 : 0x0

int _mm_ucomige_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a greater than or equal to b. If a is greater than or equal to b, 1 is returned. Otherwise 0 is returned.
r := (a0 >= b0) ? 0x1 : 0x0

int _mm_ucomineq_sd(__m128d a, __m128d b)

Compares the lower DP FP value of a and b for a not equal to b. If a and b are not equal, 1 is returned. Otherwise 0 is returned.
r := (a0 != b0) ? 0x1 : 0x0