Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
C/C++ Languages
Compiler Intrinsics
 _mm_addsub_pd

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.Net Framework 2.0

Other versions are also available for the following:
Visual C++ Language Reference
_mm_addsub_pd

Microsoft Specific

Generates the addsubpd instruction.

__m128d _mm_addsub_pd(
   __m128d a,
   __m128d b,
);

Parameters

[in] a

The first operand.

[in] b

The second operand.

Intrinsic Architecture

_mm_addsub_pd

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]);
}

Output

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
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker