Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

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

Document Table of Contents

Compare Intrinsics

Intel® Streaming SIMD Extensions 2 (Intel® SSE2) intrinsics for floating-point comparision operations are listed in the following table. The prototypes for Intel® SSE2 intrinsics are in the emmintrin.h header file.

To use these intrinsics, include the immintrin.h file as follows:

#include <immintrin.h>

Each comparison intrinsic performs a comparison of a and b. For the packed form, the two double-precision FP values of a and b are compared, and a 128-bit mask is returned. For the scalar form, the lower double-precision FP values of a and b are compared, and a 64-bit mask is returned; the upper double-precision FP value is passed through from a.

The mask is set to 0xffffffffffffffff for each element where the comparison is true, and set to 0x0 where the comparison is false. The r following the instruction name indicates that the operands to the instruction are reversed in the actual implementation.

The results of each intrinsic operation are placed in a register. The information about what is placed in each register appears in the tables below, in the detailed explanation for each intrinsic. For each intrinsic, the resulting register is represented by R, R0, and R1, where R, R0, and R1 each represent one piece of the result register.

Intrinsic Name

Operation

Corresponding
Intel® SSE2 Instruction

_mm_cmpeq_pd

Equality

CMPEQPD

_mm_cmplt_pd

Less Than

CMPLTPD

_mm_cmple_pd

Less Than or Equal

CMPLEPD

_mm_cmpgt_pd

Greater Than

CMPLTPDr

_mm_cmpge_pd

Greater Than or Equal

CMPLEPDr

_mm_cmpord_pd

Ordered

CMPORDPD

_mm_cmpunord_pd

Unordered

CMPUNORDPD

_mm_cmpneq_pd

Inequality

CMPNEQPD

_mm_cmpnlt_pd

Not Less Than

CMPNLTPD

_mm_cmpnle_pd

Not Less Than or Equal

CMPNLEPD

_mm_cmpngt_pd

Not Greater Than

CMPNLTPDr

_mm_cmpnge_pd

Not Greater Than or Equal

CMPNLEPDr

_mm_cmpeq_sd

Equality

CMPEQSD

_mm_cmplt_sd

Less Than

CMPLTSD

_mm_cmple_sd

Less Than or Equal

CMPLESD

_mm_cmpgt_sd

Greater Than

CMPLTSDr

_mm_cmpge_sd

Greater Than or Equal

CMPLESDr

_mm_cmpord_sd

Ordered

CMPORDSD

_mm_cmpunord_sd

Unordered

CMPUNORDSD

_mm_cmpneq_sd

Inequality

CMPNEQSD

_mm_cmpnlt_sd

Not Less Than

CMPNLTSD

_mm_cmpnle_sd

Not Less Than or Equal

CMPNLESD

_mm_cmpngt_sd

Not Greater Than

CMPNLTSDr

_mm_cmpnge_sd

Not Greater Than or Equal

CMPNLESDr

_mm_comieq_sd

Equality

COMISD

_mm_comilt_sd

Less Than

COMISD

_mm_comile_sd

Less Than or Equal

COMISD

_mm_comigt_sd

Greater Than

COMISD

_mm_comige_sd

Greater Than or Equal

COMISD

_mm_comineq_sd

Not Equal

COMISD

_mm_ucomieq_sd

Equality

UCOMISD

_mm_ucomilt_sd

Less Than

UCOMISD

_mm_ucomile_sd

Less Than or Equal

UCOMISD

_mm_ucomigt_sd

Greater Than

UCOMISD

_mm_ucomige_sd

Greater Than or Equal

UCOMISD

_mm_ucomineq_sd

Not Equal

UCOMISD

_mm_cmpeq_pd

__m128d _mm_cmpeq_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for equality.

R0

R1

(a0 == b0) ? 0xffffffffffffffff : 0x0

(a1 == b1) ? 0xffffffffffffffff : 0x0

_mm_cmplt_pd

__m128d _mm_cmplt_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a less than b.

R0

R1

(a0 < b0) ? 0xffffffffffffffff : 0x0

(a1 < b1) ? 0xffffffffffffffff : 0x0

_mm_cmple_pd

__m128d _mm_cmple_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a less than or equal to b.

R0

R1

(a0 <= b0) ? 0xffffffffffffffff : 0x0

(a1 <= b1) ? 0xffffffffffffffff : 0x0

_mm_cmpgt_pd

__m128d _mm_cmpgt_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a greater than b.

R0

R1

(a0 > b0) ? 0xffffffffffffffff : 0x0

(a1 > b1) ? 0xffffffffffffffff : 0x0

_mm_cmpge_pd

__m128d _mm_cmpge_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a greater than or equal to b.

R0

R1

(a0 >= b0) ? 0xffffffffffffffff : 0x0

(a1 >= b1) ? 0xffffffffffffffff : 0x0

_mm_cmpord_pd

__m128d _mm_cmpord_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for ordered.

R0

R1

(a0 ord b0) ? 0xffffffffffffffff : 0x0

(a1 ord b1) ? 0xffffffffffffffff : 0x0

_mm_cmpunord_pd

__m128d _mm_cmpunord_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for unordered.

R0

R1

(a0 unord b0) ? 0xffffffffffffffff : 0x0

(a1 unord b1) ? 0xffffffffffffffff : 0x0

_mm_cmpneq_pd

__m128d _mm_cmpneq_pd( __m128d a, __m128d b);

Compares the two DP FP values of a and b for inequality.

R0

R1

(a0 != b0) ? 0xffffffffffffffff : 0x0

(a1 != b1) ? 0xffffffffffffffff : 0x0

_mm_cmpnlt_pd

__m128d _mm_cmpnlt_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a not less than b.

R0

R1

!(a0 < b0) ? 0xffffffffffffffff : 0x0

!(a1 < b1) ? 0xffffffffffffffff : 0x0

_mm_cmpnle_pd

__m128d _mm_cmpnle_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a not less than or equal to b.

R0

R1

!(a0 <= b0) ? 0xffffffffffffffff : 0x0

!(a1 <= b1) ? 0xffffffffffffffff : 0x0

_mm_cmpngt_pd

__m128d _mm_cmpngt_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a not greater than b.

b

R0

R1

!(a0 > b0) ? 0xffffffffffffffff : 0x0

!(a1 > b1) ? 0xffffffffffffffff : 0x0

_mm_cmpnge_pd

__m128d _mm_cmpnge_pd(__m128d a, __m128d b);

Compares the two DP FP values of a and b for a not greater than or equal to b.

R0

R1

!(a0 >= b0) ? 0xffffffffffffffff : 0x0

!(a1 >= b1) ? 0xffffffffffffffff : 0x0

_mm_cmpeq_sd

__m128d _mm_cmpeq_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for equality. The upper DP FP value is passed through from a.

R0

R1

(a0 == b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmplt_sd

__m128d _mm_cmplt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a less than b. The upper DP FP value is passed through from a.

R0

R1

(a0 < b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmple_sd

__m128d _mm_cmple_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a less than or equal to b. The upper DP FP value is passed through from a.

R0

R1

(a0 <= b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpgt_sd

__m128d _mm_cmpgt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a greater than b. The upper DP FP value is passed through from a.

R0

R1

(a0 > b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpge_sd

__m128d _mm_cmpge_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a greater than or equal to b. The upper DP FP value is passed through from a.

R0

R1

(a0 >= b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpord_sd

__m128d _mm_cmpord_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for ordered. The upper DP FP value is passed through from a.

R0

R1

(a0 ord b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpunord_sd

__m128d _mm_cmpunord_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for unordered. The upper DP FP value is passed through from a.

R0

R1

(a0 unord b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpneq_sd

__m128d _mm_cmpneq_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for inequality. The upper DP FP value is passed through from a.

R0

R1

(a0 != b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpnlt_sd

__m128d _mm_cmpnlt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a not less than b. The upper DP FP value is passed through from a.

R0

R1

!(a0 < b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpnle_sd

__m128d _mm_cmpnle_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a not less than or equal to b. The upper DP FP value is passed through from a.

R0

R1

!(a0 <= b0) ? 0xffffffffffffffff : 0x0&#9;

a1

_mm_cmpngt_sd

__m128d _mm_cmpngt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a not greater than b. The upper DP FP value is passed through from a.

R0

R1

!(a0 > b0) ? 0xffffffffffffffff : 0x0

a1

_mm_cmpnge_sd

__m128d _mm_cmpnge_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a not greater than or equal to b. The upper DP FP value is passed through from a.

R0

R1

!(a0 >= b0) ? 0xffffffffffffffff : 0x0

a1

_mm_comieq_sd

int _mm_comieq_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise, 0 is returned.

R

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

_mm_comilt_sd

int _mm_comilt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a less than b. If a is less than b, 1 is returned. Otherwise, 0 is returned.

R

(a0 < b0) ? 0x1 : 0x0

_mm_comile_sd

int _mm_comile_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

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

_mm_comigt_sd

int _mm_comigt_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

(a0 > b0) ? 0x1 : 0x0

_mm_comige_sd

int _mm_comige_sd(__m128d a, __m128d b);

Compares the lower DP FP 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

_mm_comineq_sd

int _mm_comineq_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

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

_mm_ucomieq_sd

int _mm_ucomieq_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a equal to b. If a and b are equal, 1 is returned. Otherwise, 0 is returned.

R

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

_mm_ucomilt_sd

int _mm_ucomilt_sd(__m128d a, __m128d b);

Compares the lower DP FP value of a and b for a less than b. If a is less than b, 1 is returned. Otherwise, 0 is returned.

R

(a0 < b0) ? 0x1 : 0x0

_mm_ucomile_sd

int _mm_ucomile_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

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

_mm_ucomigt_sd

int _mm_ucomigt_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

(a0 > b0) ? 0x1 : 0x0

_mm_ucomige_sd

int _mm_ucomige_sd(__m128d a, __m128d b);

Compares the lower DP FP 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

_mm_ucomineq_sd

int _mm_ucomineq_sd(__m128d a, __m128d b);

Compares the lower DP FP 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.

R

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