Software Archive
Read-only legacy content
17061 Discussions

Permute some values

Jeremias_M_
Beginner
744 Views

Hi,

I'm trying to copy some values using one instruction between two registers(__m512i). I'm started using permutation, but the function _mm512_permutevar_epi32(__m512i idx, __m512i a) needs a complete new permutation (idx) for all elements and I need to keep some elements (99s in example).

I need something like that:

__m512i a = {21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36};
__m512i idx = {-,-,-,-,0,1,2,3,4,5,6,7,8,9,10,11};
__m512i dst = {99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99};

dst = _m512_permutevar_epi32(idx,a); // {99,99,99,99,21,22,23,24,25,26,27,28,29,30,31,32};

 

If anyone could suggest a instruction in KNC that do this, I appreciate.

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
744 Views

Use the variation of the same intrinsic that uses the write mask

__m512i _mm512_mask_permutexvar_epi32 (__m512i src, __mmask16 k, __m512i idx, __m512i a);
 
 
Jim Dempsey
0 Kudos
Jeremias_M_
Beginner
744 Views

Thanks.

It works well.

0 Kudos
Reply