# Arithmetic Operations

**Visual Studio .NET 2003**

**Microsoft Specific**

The intrinsics listed in the following table are followed by a description of each intrinsic.

**Packed Arithmetic Intrinsics**

Intrinsic | Instruction | Operation | R0 | R1 | R2 | R3 |
---|---|---|---|---|---|---|

_mm_add_ss | ADDSS | Adds |
a0 [op] b0 |
a1 |
a2 |
a3 |

_mm_add_ps | ADDPS | Adds |
a0 [op] b0 |
a1 [op] b1 |
a2 [op] b2 |
a3 [op] b3 |

_mm_sub_ss | SUBSS | Subtracts |
a0 [op] b0 |
a1 |
a2 |
a3 |

_mm_sub_ps | SUBPS | Subtracts |
a0 [op] b0 |
a1 [op] b1 |
a2 [op] b2 |
a3 [op] b3 |

_mm_mul_ss | MULSS | Multiplies |
a0 [op] b0 |
a1 |
a2 |
a3 |

_mm_mul_ps | MULPS | Multiplies |
a0 [op] b0 |
a1 [op] b1 |
a2 [op] b2 |
a3 [op] b3 |

_mm_div_ss | DIVSS | Divides |
a0 [op] b0 |
a1 |
a2 |
a3 |

_mm_div_ps | DIVPS | Divides |
a0 [op] b0 |
a1 [op] b1 |
a2 [op] b2 |
a3 [op] b3 |

_mm_sqrt_ss | SQRTSS | Computes squared root |
[op] a0 |
a1 |
a2 |
a3 |

_mm_sqrt_ps | SQRTPS | Computes squared root |
[op] a0 |
[op] b1 |
[op] b2 |
[op] b3 |

_mm_rcp_ss | RCPSS | Computes reciprocal |
[op] a0 |
a1 |
a2 |
a3 |

_mm_rcp_ps | RCPPS | Computes reciprocal |
[op] a0 |
[op] b1 |
[op] b2 |
[op] b3 |

_mm_rsqrt_ss | RSQRTSS | Computes reciprocal square root |
[op] a0 |
a1 |
a2 |
a3 |

_mm_rsqrt_ps | RSQRTPS | Computes reciprocal squared root |
[op] a0 |
[op] b1 |
[op] b2 |
[op] b3 |

_mm_min_ss | MINSS | Computes minimum |
[op]( a0,b0) |
a1 |
a2 |
a3 |

_mm_min_ps | MINPS | Computes minimum |
[op]( a0,b0) |
[op] (a1, b1) |
[op] (a2, b2) |
[op] (a3, b3) |

_mm_max_ss | MAXSS | Computes maximum |
[op]( a0,b0) |
a1 |
a2 |
a3 |

_mm_max_ps | MAXPS | Computes maximum |
[op]( a0,b0) |
[op] (a1, b1) |
[op] (a2, b2) |
[op] (a3, b3) |

For an explanation of the syntax used in code samples in this topic, see Floating-Point Intrinsics Using Streaming SIMD Extensions.

**__m128 _mm_add_ss(__m128 a , __m128 b )**

ADDSS

Adds the lower single-precision, floating-point values of `a`

and `b`

; the upper three single-precision, floating-point values are passed through from `a`

.

r0 := a0 + b0 r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_add_ps(__m128 a , __m128 b );**

ADDPS

Adds the four single-precision, floating-point values of `a`

and `b`

.

r0 := a0 + b0 r1 := a1 + b1 r2 := a2 + b2 r3 := a3 + b3

**__m128 _mm_sub_ss(__m128 a , __m128 b );**

SUBSS

Subtracts the lower single-precision, floating-point values of `a`

and `b`

. The upper three single-precision, floating-point values are passed through from `a`

.

r0 := a0 - b0 r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_sub_ps(__m128 a , __m128 b );**

SUBPS

Subtracts the four single-precision, floating-point values of `a`

and `b`

.

r0 := a0 - b0 r1 := a1 - b1 r2 := a2 - b2 r3 := a3 - b3

**__m128 _mm_mul_ss(__m128 a , __m128 b );**

MULSS

Multiplies the lower single-precision, floating-point values of `a`

and `b`

; the upper three single-precision, floating-point values are passed through from `a`

.

r0 := a0 * b0 r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_mul_ps(__m128 a , __m128 b );**

MULPS

Multiplies the four single-precision, floating-point values of `a`

and `b`

.

r0 := a0 * b0 r1 := a1 * b1 r2 := a2 * b2 r3 := a3 * b3

**__m128 _mm_div_ss(__m128 a , __m128 b );**

DIVSS

Divides the lower single-precision, floating-point values of `a`

and `b`

; the upper three single-precision, floating-point values are passed through from `a`

.

r0 := a0 / b0 r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_div_ps(__m128 a, __m128 b );**

DIVPS

Divides the four single-precision, floating-point values of `a`

and `b`

.

r0 := a0 / b0 r1 := a1 / b1 r2 := a2 / b2 r3 := a3 / b3

**__m128 _mm_sqrt_ss(__m128 a );**

SQRTSS

Computes the square root of the lower single-precision, floating-point value of `a`

; the upper three single-precision, floating-point values are passed through.

r0 := sqrt(a0) r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_sqrt_ps(__m128 a );**

SQRTPS

Computes the square roots of the four single-precision, floating-point values of `a`

.

r0 := sqrt(a0) r1 := sqrt(a1) r2 := sqrt(a2) r3 := sqrt(a3)

RCPSS

Computes the approximation of the reciprocal of the lower single-precision, floating-point value of `a`

; the upper three single-precision, floating-point values are passed through.

r0 := recip(a0) r1 := a1 ; r2 := a2 ; r3 := a3

RCPPS

Computes the approximations of reciprocals of the four single-precision, floating-point values of `a`

.

r0 := recip(a0) r1 := recip(a1) r2 := recip(a2) r3 := recip(a3)

**__m128 _mm_rsqrt_ss(__m128 a );**

RSQRTSS

Computes the approximation of the reciprocal of the square root of the lower single-precision, floating-point value of `a`

; the upper three single-precision, floating-point values are passed through.

r0 := recip(sqrt(a0)) r1 := a1 ; r2 := a2 ; r3 := a3

**__mm128 _mm_rsqrt_ps(__m128 a );**

RSQRTPS

Computes the approximations of the reciprocals of the square roots of the four single-precision, floating-point values of `a`

.

r0 := recip(sqrt(a0)) r1 := recip(sqrt(a1)) r2 := recip(sqrt(a2)) r3 := recip(sqrt(a3))

**__m128 _mm_min_ss(__m128 a , __m128 b );**

MINSS

Computes the minimum of the lower single-precision, floating-point values of `a`

and `b`

; the upper three single-precision, floating-point values are passed through from `a`

.

r0 := min(a0, b0) r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_min_ps(__m128 a , __m128 b );**

MINPS

Computes the minima of the four single-precision, floating-point values of `a`

and `b`

.

r0 := min(a0, b0) r1 := min(a1, b1) r2 := min(a2, b2) r3 := min(a3, b3)

**__m128 _mm_max_ss(__m128 a , __m128 b );**

MAXSS

Computes the maximum of the lower single-precision, floating-point values of `a`

and `b`

; the upper three single-precision, floating-point values are passed through from `a`

.

r0 := max(a0, b0) r1 := a1 ; r2 := a2 ; r3 := a3

**__m128 _mm_max_ps(__m128 a , __m128 b );**

MAXPS

Computes the maximums of the four single-precision, floating-point values of `a`

and `b`

.

r0 := max(a0, b0) r1 := max(a1, b1) r2 := max(a2, b2) r3 := max(a3, b3)

**END Microsoft Specific**