Export (0) Print
Expand All

Comparison Intrinsics

Microsoft Specific

Each comparison intrinsic performs a comparison of a and b. For the packed form, the four single-precision, floating-point values of a and b are compared, and a 128-bit mask is returned. For the scalar form, the lower single-precision, floating-point values of a and b are compared, and a 32-bit mask is returned; the upper three single-precision, floating-point values are passed through from a. The mask is set to 0xffffffff for each element where the comparison is true and 0x0 where the comparison is false.

The superscript 'r' on the instruction indicates that the operands are reversed in the instruction implementation. The compare intrinsics listed in the following table are followed by a description of each intrinsic.

Compare Intrinsics

Intrinsic name Comparison Corresponding instruction
_mm_cmpeq_ss Equal CMPEQSS
_mm_cmpeq_ps Equal CMPEQPS
_mm_cmplt_ss Less than CMPLTSS
_mm_cmplt_ps Less than CMPLTPS
_mm_cmple_ss Less than or equal CMPLESS
_mm_cmple_ps Less than or equal CMPLEPS
_mm_cmpgt_ss Greater than CMPLTSS
_mm_cmpgt_ps Greater than CMPLTPS
_mm_cmpge_ss Greater than or equal CMPLESS
_mm_cmpge_ps Greater than or equal CMPLEPS
_mm_cmpneq_ss Not equal CMPNEQSS
_mm_cmpneq_ps Not equal CMPNEQPS
_mm_cmpnlt_ss Not less than CMPNLTSS
_mm_cmpnlt_ps Not less than CMPNLTPS
_mm_cmpnle_ss Not less than or equal CMPNLESS
_mm_cmple_ps Not less than or equal CMPNLEPS
_mm_cmpngt_ss Not greater than CMPNLTSS
_mm_cmpngt_ps Not greater than CMPNLTPS
_mm_cmpnge_ss Not greater than or equal CMPNLESS
_mm_cmpnge_ps Not greater than or equal CMPNLEPS
_mm_cmpord_ss Ordered CMPORDSS
_mm_cmpord_ps Ordered CMPORDPS
_mm_cmpunord_ss Unordered CMPUNORDSS
_mm_cmpunord_ps Unordered CMPUNORDPS
_mm_comieq_ss Equal COMISS
_mm_comilt_ss Less than COMISS
_mm_comile_ss Less than or equal COMISS
_mm_comigt_ss Greater than COMISS
_mm_comige_ss Greater than or equal COMISS
_mm_comineq_ss Not equal COMISS
_mm_ucomieq_ss Equal UCOMISS
_mm_ucomilt_ss Less than UCOMISS
_mm_ucomile_ss Less than or equal UCOMISS
_mm_ucomigt_ss Greater than UCOMISS
_mm_ucomige_ss Greater than or equal UCOMISS
_mm_ucomineq_ss Not equal UCOMISS

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

__m128 _mm_cmpeq_ss(__m128 a , __m128 b );

CMPEQSS

Compares for equality.

r0 := (a0 == b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpeq_ps(__m128 a , __m128 b );

CMPEQPS

Compares for equality.

r0 := (a0 == b0) ? 0xffffffff : 0x0
r1 := (a1 == b1) ? 0xffffffff : 0x0
r2 := (a2 == b2) ? 0xffffffff : 0x0
r3 := (a3 == b3) ? 0xffffffff : 0x0

__m128 _mm_cmplt_ss(__m128 a , __m128 b );

CMPLTSS

Compares for less than.

r0 := (a0 < b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmplt_ps(__m128 a, __m128 b );

CMPLTPS

Compares for less than.

r0 := (a0 < b0) ? 0xffffffff : 0x0
r1 := (a1 < b1) ? 0xffffffff : 0x0
r2 := (a2 < b2) ? 0xffffffff : 0x0
r3 := (a3 < b3) ? 0xffffffff : 0x0

__m128 _mm_cmple_ss(__m128 a , __m128 b );

CMPLESS

Compares for less than or equal.

r0 := (a0 <= b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmple_ps(__m128 a , __m128 b );

CMPLEPS

Compares for less than or equal.

r0 := (a0 <= b0) ? 0xffffffff : 0x0
r1 := (a1 <= b1) ? 0xffffffff : 0x0
r2 := (a2 <= b2) ? 0xffffffff : 0x0
r3 := (a3 <= b3) ? 0xffffffff : 0x0

__m128 _mm_cmpgt_ss(__m128 a , __m128 b );

CMPLTSSr

Compares for greater than.

r0 := (a0 > b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpgt_ps(__m128 a, __m128 b );

CMPLTPSr

Compares for greater than.

r0 := (a0 > b0) ? 0xffffffff : 0x0
r1 := (a1 > b1) ? 0xffffffff : 0x0
r2 := (a2 > b2) ? 0xffffffff : 0x0
r3 := (a3 > b3) ? 0xffffffff : 0x0

__m128 _mm_cmpge_ss(__m128 a , __m128 b );

CMPLESSr

Compares for greater than or equal.

r0 := (a0 >= b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpge_ps(__m128 a, __m128 b );

CMPLEPSr

Compares for greater than or equal.

r0 := (a0 >= b0) ? 0xffffffff : 0x0
r1 := (a1 >= b1) ? 0xffffffff : 0x0
r2 := (a2 >= b2) ? 0xffffffff : 0x0
r3 := (a3 >= b3) ? 0xffffffff : 0x0

__m128 _mm_cmpneq_ss(__m128 a , __m128 b );

CMPNEQSS

Compares for inequality.

r0 := (a0 != b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpneq_ps(__m128 a , __m128 b );

CMPNEQPS

Compares for inequality.

r0 := (a0 != b0) ? 0xffffffff : 0x0
r1 := (a1 != b1) ? 0xffffffff : 0x0
r2 := (a2 != b2) ? 0xffffffff : 0x0
r3 := (a3 != b3) ? 0xffffffff : 0x0

__m128 _mm_cmpnlt_ss(__m128 a , __m128 b );

CMPNLTSS

Compares for not less than.

r0 := !(a0 < b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpnlt_ps(__m128 a, __m128 b );

CMPNLTPS

Compares for not less than.

r0 := !(a0 < b0) ? 0xffffffff : 0x0
r1 := !(a1 < b1) ? 0xffffffff : 0x0
r2 := !(a2 < b2) ? 0xffffffff : 0x0
r3 := !(a3 < b3) ? 0xffffffff : 0x0

__m128 _mm_cmpnle_ss(__m128 a , __m128 b );

CMPNLESS

Compares for not less than or equal.

r0 := !(a0 <= b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpnle_ps(__m128 a , __m128 b );

CMPNLEPS

Compares for not less than or equal.

r0 := !(a0 <= b0) ? 0xffffffff : 0x0
r1 := !(a1 <= b1) ? 0xffffffff : 0x0
r2 := !(a2 <= b2) ? 0xffffffff : 0x0
r3 := !(a3 <= b3) ? 0xffffffff : 0x0

__m128 _mm_cmpngt_ss(__m128 a , __m128 b );

CMPNLTSSr

Compares for not greater than.

r0 := !(a0 > b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpngt_ps(__m128 a , __m128 b );

CMPNLTPSr

Compares for not greater than.

r0 := !(a0 > b0) ? 0xffffffff : 0x0
r1 := !(a1 > b1) ? 0xffffffff : 0x0
r2 := !(a2 > b2) ? 0xffffffff : 0x0
r3 := !(a3 > b3) ? 0xffffffff : 0x0

__m128 _mm_cmpnge_ss(__m128 a , __m128 b );

CMPNLESSr

Compares for not greater than or equal.

r0 := !(a0 >= b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpnge_ps(__m128 a , __m128 b );

MPNLEPSr

Compares for not greater than or equal.

r0 := !(a0 >= b0) ? 0xffffffff : 0x0
r1 := !(a1 >= b1) ? 0xffffffff : 0x0
r2 := !(a2 >= b2) ? 0xffffffff : 0x0
r3 := !(a3 >= b3) ? 0xffffffff : 0x0

__m128 _mm_cmpord_ss(__m128 a , __m128 b );

CMPORDSS

Compares for ordered.

r0 := (a0 ord? b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpord_ps(__m128 a , __m128 b );

CMPORDPS

Compares for ordered.

r0 := (a0 ord? b0) ? 0xffffffff : 0x0
r1 := (a1 ord? b1) ? 0xffffffff : 0x0
r2 := (a2 ord? b2) ? 0xffffffff : 0x0
r3 := (a3 ord? b3) ? 0xffffffff : 0x0

__m128 _mm_cmpunord_ss(__m128 a , __m128 b );

CMPUNORDSS

Compares for unordered.

r0 := (a0 unord? b0) ? 0xffffffff : 0x0
r1 := a1 ; r2 := a2 ; r3 := a3

__m128 _mm_cmpunord_ps(__m128 a , __m128 b );

CMPUNORDPS

Compares for unordered.

r0 := (a0 unord? b0) ? 0xffffffff : 0x0
r1 := (a1 unord? b1) ? 0xffffffff : 0x0
r2 := (a2 unord? b2) ? 0xffffffff : 0x0
r3 := (a3 unord? b3) ? 0xffffffff : 0x0

int _mm_comieq_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise, 0 is returned. If a or b is a NaN, 1 is returned.

r := (a0 == b0) ? 0x1 : 0x0

int _mm_comilt_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point value of a and b for a less than b. If a is less than b, 1 is returned. Otherwise, 0 is returned. If a or b is a NaN, 1 is returned.

r := (a0 < b0) ? 0x1 : 0x0

int _mm_comile_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 <= b0) ? 0x1 : 0x0

int _mm_comigt_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 > b0) ? 0x1 : 0x0

int _mm_comige_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 >= b0) ? 0x1 : 0x0

int _mm_comineq_ss(__m128 a,__m128 b );

COMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 != b0) ? 0x1 : 0x0

int _mm_ucomieq_ss(__m128 a,__m128 b );

UCOMISS

Compares the lower single-precision, floating-point value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise, 0 is returned. If a or b is a NaN, 1 is returned.

r := (a0 == b0) ? 0x1 : 0x0

int _mm_ucomilt_ss(__m128 a,__m128 b);

UCOMISS

Compares the lower single-precision, floating-point value of a and b for a less than b. If a is less than b , 1 is returned. Otherwise, 0 is returned. If a or b is a NaN, 1 is returned.

r := (a0 < b0) ? 0x1 : 0x0

int _mm_ucomile_ss(__m128 a,__m128 b );

UCOMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 <= b0) ? 0x1 : 0x0

int _mm_ucomigt_ss(__m128 a,__m128 b );

UCOMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned. If a or b is a NaN, 1 is returned.

r := (a0 > b0) ? 0x1 : 0x0

int _mm_ucomige_ss(__m128 a,__m128 b );

UCOMISS

Compares the lower single-precision, floating-point 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_ss(__m128 a,__m128 b );

UCOMISS

Compares the lower single-precision, floating-point 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. If a or b is a NaN, 1 is returned.

r := (a0 != b0) ? 0x1 : 0x0 

END Microsoft Specific

See Also

Floating-Point Intrinsics Using Streaming SIMD Extensions

Show:
© 2014 Microsoft