Microsoft Specific

Generates the addsubpd instruction.

__m128d _mm_addsub_pd(
   __m128d a,
   __m128d b,


  • [in] a
    The first operand.

  • [in] b
    The second operand.





Intel SSE3

Header file <intrin.h>


The addsubpd instruction performs a packed operation involving double-precision addition and subtraction on 128-bit data. Each 128-bit operand consists of two 64-bit data elements, numbered from 0 to 1, with 1 being the high-order element. The operation subtracts the numbers in the low-order data elements and adds the numbers in the high-order elements. Thus, if the input is { A0, A1 } and { B0, B1 }, then the output is { A0–B0, A1+B1 }.

This routine is only available as an intrinsic.


// processor: x86 with SSE3
// Execute the addsub_pd instruction using the intrinsic
// _mm_addsub_pd 

#include <stdio.h>
#include <intrin.h>

#pragma intrinsic ( _mm_addsub_pd )

int main( )
    __m128d u, v, w;
    __declspec(align(16)) double a[2] = { 0.1, 0.2 };
    __declspec(align(16)) double b[2] = { 0.001, 0.002 };

    printf_s("Loading double values %e %e into XMM register.\n",
             a[0], a[1] );
    u = _mm_load_pd(a);
    printf_s("Loading double values %e %e into XMM register.\n",
             b[0], b[1] );
    v = _mm_load_pd(b);

    printf_s("Calling _mm_addsub_pd to modify these values.\n");
    w = _mm_addsub_pd ( u , v);

    printf_s("Result: %e %e \n", w.m128d_f64[0], w.m128d_f64[1]);
Loading double values 1.000000e-001 2.000000e-001 into XMM register.
Loading double values 1.000000e-003 2.000000e-003 into XMM register.
Calling _mm_addsub_pd to modify these values.
Result: 9.900000e-002 2.020000e-001

See Also


Compiler Intrinsics