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)

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