Developer Guide and Reference

Contents

_mm_blend_epi32, _mm256_blend_epi16/32

Conditionally blends data elements of source vector depending on bits in a mask. The corresponding Intel® AVX2 instruction is
VPBLENDD
or
VPBLENDW
.

Syntax

extern __m128i _mm_blend_epi32(__m128i s1, __m128i s2, const int mask);
extern __m256i _mm256_blend_epi16(__m256i s1, __m256i s2, const int mask);
extern __m256i _mm256_blend_epi32(__m256i s1, __m256i s2, const int mask);
Arguments
s1
integer source vector used for the operation
s2
integer source vector used for the operation
mask
8-bit immediate used for the operation
Description
Performs a blend operation by conditionally copying 16/32-bit [word/doubleword] elements from source vectors
s2
and
s1
, depending on mask bits defined in
mask
. The mask bits are the least significant 8 bits in
mask
when the 256-bit intrinsics,
_mm256_blend_epi16
/
_mm256_blend_epi32
, are used, and 4 bits when the 128-bit intrinsic,
_mm_blend_epi32
, is used.
Each word/doubleword element of the destination vector is copied from the corresponding word/doubleword element in
s2
if a mask bit is 1, or is copied from the corresponding word/doubleword element in
s1
if a mask bit is 0.
Returns
Result of the blend operation.