Share via


_mm_blend_pd

Microsoft Specific

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

__m128d _mm_blend_pd( 
   __m128d a,
   __m128d b,
   const int mask 
);

Parameters

  • [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 constant mask that selects components for the blend operation.

Return value

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

Requirements

Intrinsic

Architecture

_mm_blend_pd

x86, x64

Header file <smmintrin.h>

Remarks

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

mask0 and mask1 are the two least significant bits of parameter mask.

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

Example

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

int main () {
    __m128d a, b;
    const int mask = 2;

    a.m128d_f64[1] = -10.5;
    a.m128d_f64[0] = -3.14159;
    b.m128d_f64[1] = 500.25;
    b.m128d_f64[0] = 2.19;

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

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

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

   return 0;
}
Original a: -10.500000  -3.141590
Original b: 500.250000   2.190000
Result res: 500.250000  -3.141590

See Also

Reference

Compiler Intrinsics