Comparison Operators

The equality and inequality comparison operands can have mixed signedness, but they must be of the same size. The comparison operators for less-than and greater-than must be of the same sign and size. For example:

Inequality Comparison Symbols and Corresponding Intrinsics

Comparison

Operators

Syntax

Intrinsic

Equality

cmpeq

R = cmpeq(A, B)

_mm_cmpeq_pi32
_mm_cmpeq_pi16
_mm_cmpeq_pi8

Inequality

cmpneq

R = cmpneq(A, B)

_mm_cmpeq_pi32
_mm_cmpeq_pi16
_mm_cmpeq_pi8
_mm_andnot_si64

Greater Than

cmpgt

R = cmpgt(A, B)

_mm_cmpgt_pi32
_mm_cmpgt_pi16
_mm_cmpgt_pi8

Greater Than
or Equal To

cmpge

R = cmpge(A, B)

_mm_cmpgt_pi32
_mm_cmpgt_pi16
_mm_cmpgt_pi8
_mm_andnot_si64

Less Than

cmplt

R = cmplt(A, B)

_mm_cmpgt_pi32
_mm_cmpgt_pi16
_mm_cmpgt_pi8

Less Than
or Equal To

cmple

R = cmple(A, B)

_mm_cmpgt_pi32
_mm_cmpgt_pi16
_mm_cmpgt_pi8
_mm_andnot_si64

Compare Operator Overloading

Comparison operators have the restriction that the operands must be the size and sign as listed in the following table.

R

Comparison

Operand A

Operand B

I32vec2 R

cmpeq
cmpne

I[s|u]32vec2 B

I[s|u]32vec2 B

I16vec4 R

 

I[s|u]16vec4 B

I[s|u]16vec4 B

I8vec8 R

 

I[s|u]8vec8 B

I[s|u]8vec8 B

I32vec2 R

cmpgt
cmpge
cmplt
cmple

Is32vec2 B

Is32vec2 B

I16vec4 R

 

Is16vec4 B

Is16vec4 B

I8vec8 R

 

Is8vec8 B

Is8vec8 B