Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
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.

Compare Operators and Corresponding Intrinsics

Compare For:

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.

Compare Operator Return Value Mapping

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

Compare Operations for Fvec Classes

The following table shows examples for arithmetic operators and intrinsics.

Returns

Example Syntax Usage

Intrinsic

Compare for 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

Compare for 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

Compare for 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

Compare for Less Than or Equal

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

Compare for 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

Compare for 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

Compare for 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

Compare for Not Less Than or Equal

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

Compare for 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

Compare for Not Greater Than or Equal

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