Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 7/13/2023
Public
Document Table of Contents

Arithmetic Intrinsics

Intel® Streaming SIMD Extensions 2 (Intel® SSE2) intrinsics for floating-point arithmetic operations are listed in this topic. 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>

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 R0 and R1, where R0 and R1 each represent one piece of the result register.

Intrinsic Name

Operation

Corresponding
Intel® SSE2 Instruction

_mm_add_sd

Addition

ADDSD

_mm_add_pd

Addition

ADDPD

_mm_sub_sd

Subtraction

SUBSD

_mm_sub_pd

Subtraction

SUBPD

_mm_mul_sd

Multiplication

MULSD

_mm_mul_pd

Multiplication

MULPD

_mm_div_sd

Division

DIVSD

_mm_div_pd

Division

DIVPD

_mm_sqrt_sd

Computes Square Root

SQRTSD

_mm_sqrt_pd

Computes Square Root

SQRTPD

_mm_min_sd

Computes Minimum

MINSD

_mm_min_pd

Computes Minimum

MINPD

_mm_max_sd

Computes Maximum

MAXSD

_mm_max_pd

Computes Maximum

MAXPD

_mm_add_sd

__m128d _mm_add_sd(__m128d a, __m128d b);

Adds the lower double-precision FP (floating-point) values of a and b; the upper double-precision FP value is passed through from a.

R0

R1

a0 + b0

a1

_mm_add_pd

__m128d _mm_add_pd(__m128d a, __m128d b);

Adds the two DP FP values of a and b.

R0

R1

a0 + b0

a1 + b1

_mm_sub_sd

__m128d _mm_sub_sd(__m128d a, __m128d b);

Subtracts the lower DP FP value of b from a. The upper DP FP value is passed through from a.

R0

R1

a0 - b0

a1

_mm_sub_pd

__m128d _mm_sub_pd(__m128d a, __m128d b);

Subtracts the two DP FP values of b from a.

R0

R1

a0 - b0

a1 - b1

_mm_mul_sd

__m128d _mm_mul_sd(__m128d a, __m128d b);

Multiplies the lower DP FP values of a and b. The upper DP FP is passed through from a.

R0

R1

a0 * b0

a1

_mm_mul_pd

__m128d _mm_mul_pd(__m128d a, __m128d b);

Multiplies the two DP FP values of a and b.

R0

R1

a0 * b0

a1 * b1

_mm_div_sd

__m128d _mm_div_sd(__m128d a, __m128d b);

Divides the lower DP FP values of a and b. The upper DP FP value is passed through from a.

R0

R1

a0 / b0

a1

_mm_div_pd

__m128d _mm_div_pd(__m128d a, __m128d b);

Divides the two DP FP values of a and b.

R0

R1

a0 / b0

a1 / b1

_mm_sqrt_sd

__m128d _mm_sqrt_sd(__m128d a, __m128d b);

Computes the square root of the lower DP FP value of b. The upper DP FP value is passed through from a.

R0

R1

sqrt(b0)

a1

_mm_sqrt_pd

__m128d _mm_sqrt_pd(__m128d a);

Computes the square root of the two DP FP values of a.

R0

R1

sqrt(a0)

sqrt(a1)

_mm_min_sd

__m128d _mm_min_sd(__m128d a, __m128d b);

Computes the minimum of the lower DP FP values of a and b. The upper DP FP value is passed through from a.

R0

R1

min (a0, b0)

a1

_mm_min_pd

__m128d _mm_min_pd(__m128d a, __m128d b);

Computes the minima of the two DP FP values of a and b.

R0

R1

min (a0, b0)

min(a1, b1)

_mm_max_sd

__m128d _mm_max_sd(__m128d a, __m128d b);

Computes the maximum of the lower DP FP values of a and b. The upper DP FP value is passed through from a.

R0

R1

max (a0, b0)

a1

_mm_max_pd

__m128d _mm_max_pd(__m128d a, __m128d b);

Computes the maxima of the two DP FP values of a and b.

R0

R1

max (a0, b0)

max (a1, b1)