Floating-point Arithmetic Operations for Streaming SIMD Extensions 2

The arithmetic operations for the Streaming SIMD Extensions 2 (SSE2) are listed in the following table. The prototypes for SSE2 intrinsics are in the emmintrin.h header file.

For detailed information about an intrinsic, click on that intrinsic name in the following table.

The results of each intrinsic operation are placed in a register. This register is illustrated for each intrinsic with R0 and R1. R0 and R1 each represent one piece of the result register.

The Double Complex code sample contains examples of how to use several of these intrinsics.

Intrinsic
Name
Operation Corresponding 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

 

__m128d _mm_add_sd(__m128d a, __m128d b)

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

R0 R1
a0 + b0 a1

 

__m128d _mm_add_pd(__m128d a, __m128d b)

Adds the two DP FP values of a and b.

R0 R1
a0 + b0 a1 + b1

 

__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

 

__m128d _mm_sub_pd(__m128d a, __m128d b)

Subtracts the two DP FP values of b from a.

R0 R1
a0 - b0 a1 - b1

 

__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

 

__m128d _mm_mul_pd(__m128d a, __m128d b)

Multiplies the two DP FP values of a and b.

R0 R1
a0 * b0 a1 * b1

 

__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

 

__m128d _mm_div_pd(__m128d a, __m128d b)

Divides the two DP FP values of a and b.

R0 R1
a0 / b0 a1 / b1

 

__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

 

__m128d _mm_sqrt_pd(__m128d a)

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

R0 R1
sqrt(a0) sqrt(a1)

 

__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

 

__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)

 

__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

 

__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)