Export (0) Print
Expand All
Expand Minimize

_mm_blendv_pd

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction blendvpd. This function blends packed double precision floating point values.

__m128d _mm_blendv_pd( 
   __m128d a,
   __m128d b,
   __m128d mask 
);

[in] a

A 128-bit parameter that contains two 64-bit floating point values to be blended.

[in] b

A 128-bit parameter that contains two 64-bit floating point values to be blended.

[in] mask

A 128-bit mask that selects components for the blend operation.

r0 := (mask0 & 0x8000000000000000) ? b0 : a0
r1 := (mask1 & 0x8000000000000000) ? b1 : a1

Intrinsic

Architecture

_mm_blendv_pd

x86, x64

Header file <smmintrin.h>

r0, a0, b0, and mask0 are the low order 64 bits of return value r and parameters a, b, and mask. r1, a1, b1, and mask1 are the high order 64 bits of return value r and parameters a, b, and mask.

Before using this intrinsic, software must ensure that the processor supports the instruction.

#include <stdio.h>
#include <smmintrin.h>

int main () {
    __m128d a, b, mask;
    unsigned __int64 maskValue = 0x8000000000000000;

    mask.m128d_f64[1] = *reinterpret_cast<double *>(&maskValue);
    mask.m128d_f64[0] = 0x0000000000000000;

    a.m128d_f64[1] = -500.17;
    a.m128d_f64[0] = -21734.56;
    b.m128d_f64[1] = 3.141592;
    b.m128d_f64[0] = 10.5;

    __m128d res = _mm_blendv_pd( a, b, mask );

    printf_s("Original a: %14f %14f\nOriginal b: %14f %14f\n",
                a.m128d_f64[1], a.m128d_f64[0],
                b.m128d_f64[1], b.m128d_f64[0]);

    printf_s("Result res: %14f %14f\n",
                res.m128d_f64[1], res.m128d_f64[0]);

    return 0;
}
Original a:    -500.170000  -21734.560000
Original b:       3.141592      10.500000
Result res:       3.141592  -21734.560000

Community Additions

ADD
Show:
© 2014 Microsoft