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.

For detailed information about an intrinsic, click on that intrinsic name in the following table.

The results of each intrinsic operation are placed in a register. This register is illustrated for each intrinsic with R, R0 and R1. R, R0 and R1 each represent one piece of the result register.

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

Intrinsic
Name
Operation Corresponding SSE2
Instruction
_mm_cmpeq_pd Equality CMPEQPD
_mm_cmplt_pd Less Than CMPLTPD
_mm_cmple_pd Less Than or Equal CMPLEPD
_mm_cmpgt_pd Greater Than CMPLTPDr
_mm_cmpge_pd Greater Than or Equal CMPLEPDr
_mm_cmpord_pd Ordered CMPORDPD
_mm_cmpunord_pd Unordered CMPUNORDPD
_mm_cmpneq_pd Inequality CMPNEQPD
_mm_cmpnlt_pd Not Less Than CMPNLTPD
_mm_cmpnle_pd Not Less Than or Equal CMPNLEPD
_mm_cmpngt_pd Not Greater Than CMPNLTPDr
_mm_cmpnge_pd Not Greater Than or Equal CMPNLEPDr
_mm_cmpeq_sd Equality CMPEQSD
_mm_cmplt_sd Less Than CMPLTSD
_mm_cmple_sd Less Than or Equal CMPLESD
_mm_cmpgt_sd Greater Than CMPLTSDr
_mm_cmpge_sd Greater Than or Equal CMPLESDr
_mm_cmpord_sd Ordered CMPORDSD
_mm_cmpunord_sd Unordered CMPUNORDSD
_mm_cmpneq_sd Inequality CMPNEQSD
_mm_cmpnlt_sd Not Less Than CMPNLTSD
_mm_cmpnle_sd Not Less Than or Equal CMPNLESD
_mm_cmpngt_sd Not Greater Than CMPNLTSDr
_mm_cmpnge_sd Not Greater Than or Equal CMPNLESDr
_mm_comieq_sd Equality COMISD
_mm_comilt_sd Less Than COMISD
_mm_comile_sd Less Than or Equal COMISD
_mm_comigt_sd Greater Than COMISD
_mm_comige_sd Greater Than or Equal COMISD
_mm_comineq_sd Not Equal COMISD
_mm_ucomieq_sd Equality UCOMISD
_mm_ucomilt_sd Less Than UCOMISD
_mm_ucomile_sd Less Than or Equal UCOMISD
_mm_ucomigt_sd Greater Than UCOMISD
_mm_ucomige_sd Greater Than or Equal UCOMISD
_mm_ucomineq_sd Not Equal UCOMISD

 

__m128d _mm_cmpeq_pd(__m128d a, __m128d b)

Compares the two DP FP values of a and b for equality.

R0 R1
(a0 == b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 < b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 <= b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 > b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 >= b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 ord b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 unord b0) ? 0xffffffffffffffff : 0x0 (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 R1
(a0 != b0) ? 0xffffffffffffffff : 0x0 (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 R1
!(a0 < b0) ? 0xffffffffffffffff : 0x0 !(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 R1
!(a0 <= b0) ? 0xffffffffffffffff : 0x0 !(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 R1
!(a0 > b0) ? 0xffffffffffffffff : 0x0 !(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 R1
!(a0 >= b0) ? 0xffffffffffffffff : 0x0 !(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 R1
(a0 == b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 < b0) ? 0xffffffffffffffff : 0x0 a1

 

__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 R1
(a0 <= b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 > b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 >= b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 ord b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 unord b0) ? 0xffffffffffffffff : 0x0 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 R1
(a0 != b0) ? 0xffffffffffffffff : 0x0 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 R1
!(a0 < b0) ? 0xffffffffffffffff : 0x0 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 R1
!(a0 <= b0) ? 0xffffffffffffffff : 0x0

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 R1
!(a0 > b0) ? 0xffffffffffffffff : 0x0 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 R1
!(a0 >= b0) ? 0xffffffffffffffff : 0x0 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