Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Compare Operators

The operators described in this section compare the single precision floating-point values of A and B. Comparison between objects of any Fvec class return the same class being compared.

The following table lists the compare operators for the Fvec classes:

Comparison

Operators

Syntax

Equality

cmpeq

R = cmpeq(A, B)

Inequality

cmpneq

R = cmpneq(A, B)

Greater Than

cmpgt

R = cmpgt(A, B)

Greater Than or Equal To

cmpge

R = cmpge(A, B)

Not Greater Than

cmpngt

R = cmpngt(A, B)

Not Greater Than or Equal To

cmpnge

R = cmpnge(A, B)

Less Than

cmplt

R = cmplt(A, B)

Less Than or Equal To

cmple

R = cmple(A, B)

Not Less Than

cmpnlt

R = cmpnlt(A, B)

Not Less Than or Equal To

cmpnle

R = cmpnle(A, B)

Compare Operators

The mask is set to 0xffffffff for each floating-point value where the comparison is true and 0x00000000 where the comparison is false. The following table shows the return values for each class of the compare operators, which use the syntax described earlier in the Return Value Notation section:

R

A0

For Any Operators

B

If True

If False

F32vec4

F64vec2

F32vec1

R0:=

(A1
!(A1

cmp[eq | lt | le | gt | ge]
cmp[ne | nlt | nle | ngt | nge]

B1)
B1)

0xffffffff

0x0000000

X

X

X

R1:=

(A1
!(A1

cmp[eq | lt | le | gt | ge]
cmp[ne | nlt | nle | ngt | nge]

B2)
B2)

0xffffffff

0x0000000
 

X

X

N/A

R2:=

(A1
!(A1

cmp[eq | lt | le | gt | ge]
cmp[ne | nlt | nle | ngt | nge]

B3)
B3)

0xffffffff

0x0000000
 

X

N/A

N/A

R3:=

A3

cmp[eq | lt | le | gt | ge]
cmp[ne | nlt | nle | ngt | nge]

B3)
B3)

0xffffffff

0x0000000
 

X

N/A

N/A

The following table shows examples for comparison operators and intrinsics:

Comparison

Returns

Example Syntax Usage

Intrinsic

Equality

4 floats

F32vec4 R = cmpeq(F32vec4 A);

_mm_cmpeq_ps

2 doubles

F64vec2 R = cmpeq(F64vec2 A);

_mm_cmpeq_pd

1 float

F32vec1 R = cmpeq(F32vec1 A);

_mm_cmpeq_ss

Inequality

4 floats

F32vec4 R = cmpneq(F32vec4 A);

_mm_cmpneq_ps

2 doubles

F64vec2 R = cmpneq(F64vec2 A);

_mm_cmpneq_pd

1 float

F32vec1 R = cmpneq(F32vec1 A);

_mm_cmpneq_ss

Greater Than

4 floats

F32vec4 R = cmpgt(F32vec4 A);

_mm_cmpgt_ps

2 doubles

F64vec2 R = cmpgt(F32vec42 A);

_mm_cmpgt_pd

1 float

F32vec1 R = cmpgt(F32vec1 A);

_mm_cmpgt_ss

Greater Than or Equal To

4 floats

F32vec4 R = cmpge(F32vec4 A);

_mm_cmpge_ps

2 doubles

F64vec2 R = cmpge(F64vec2 A);

_mm_cmpge_pd

1 float

F32vec1 R = cmpge(F32vec1 A);

_mm_cmpge_ss

Not Greater Than

4 floats

F32vec4 R = cmpngt(F32vec4 A);

_mm_cmpngt_ps

2 doubles

F64vec2 R = cmpngt(F64vec2 A);

_mm_cmpngt_pd

1 float

F32vec1 R = cmpngt(F32vec1 A);

_mm_cmpngt_ss

Not Greater Than or Equal To

4 floats

F32vec4 R = cmpnge(F32vec4 A);

_mm_cmpnge_ps

2 doubles

F64vec2 R = cmpnge(F64vec2 A);

_mm_cmpnge_pd

1 float

F32vec1 R = cmpnge(F32vec1 A);

_mm_cmpnge_ss

Less Than

4 floats

F32vec4 R = cmplt(F32vec4 A);

_mm_cmplt_ps

2 doubles

F64vec2 R = cmplt(F64vec2 A);

_mm_cmplt_pd

1 float

F32vec1 R = cmplt(F32vec1 A);

_mm_cmplt_ss

Less Than or Equal To

4 floats

F32vec4 R = cmple(F32vec4 A);

_mm_cmple_ps

2 doubles

F64vec2 R = cmple(F64vec2 A);

_mm_cmple_pd

1 float

F32vec1 R = cmple(F32vec1 A);

_mm_cmple_pd

Not Less Than

4 floats

F32vec4 R = cmpnlt(F32vec4 A);

_mm_cmpnlt_ps

2 doubles

F64vec2 R = cmpnlt(F64vec2 A);

_mm_cmpnlt_pd

1 float

F32vec1 R = cmpnlt(F32vec1 A);

_mm_cmpnlt_ss

Not Less Than or Equal To

4 floats

F32vec4 R = cmpnle(F32vec4 A);

_mm_cmpnle_ps

2 doubles

F64vec2 R = cmpnle(F64vec2 A);

_mm_cmpnle_pd

1 float

F32vec1 R = cmpnle(F32vec1 A);

_mm_cmpnle_ss