_mm256_permute2_pd, _mm_permute2_pd

Permutes two float64 values into a destination vector. The corresponding Intel® AVX instruction is VPERMIL2PD.

Syntax

extern __m256d __cdecl _mm256_permute2_pd(__m256d a, __m256d b, _m256i ctrl, int imm);

extern __m128d __cdecl _mm_permute2_pd(__m128d a, __m128d b, _m128i ctrl, int imm);

Arguments

a

a 256-bit or 128-bit float64 source vector

b

a 256-bit or 128-bit float64 source vector

ctrl

A vector with

  • 2-bit source_select fields, one for each corresponding element of the source vectors
  • a match bit

The zero_match field of the imm argument and the match bit of ctrl vector determine the value that is written to the corresponding data element in the destination vector.

imm

an immediate byte that specifies a 2-bit zero_match control field

Description

Permutes two double-precision floating-point (float64) values. The intrinsic selects one float64 value from one pair (from 128-bit source) or two pairs (from 256-bit source) of float64 values in the source vectors, a and b. The selection is based on the source select field specified in the third vector, ctrl.

Each selected float64 value is either copied or substituted with zero in the destination vector depending on the respective match bit in the ctrl vector and the zero_match control field specified by the imm parameter.

Returns

A 256-bit or 128-bit float64 vector with permuted values.