Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 7/13/2023
Public
Document Table of Contents

_mm256_shuffle_epi8

Shuffles bytes in the first source vector according to the shuffle control mask in the second source vector. The corresponding Intel® AVX2 instruction is VPSHUFB.

Syntax

extern __m256i _mm256_shuffle_epi8(__m256i a, __m256i b);

Arguments

a

integer source vector

b

integer source vector

Description

Performs shuffle operations of the signed or unsigned 8-bit integers in the source vector as specified by the shuffle control mask in the second source operand.

Below is the pseudocode interpreting a, b, and r as arrays of unsigned 8-bit integers:

for (i = 0; i < 16; i++){
  if (b[i] & 0x80){
    r[i] =  0;
  }
  else{
    r[i] = a[b[i] & 0x0F];
  }
  if (b[16+i] & 0x80){
    r[16+i] =  0;
  }
  else{
    r[16+i] = a[16+(b[16+i] & 0x0F)];
  }
}

Returns

Result of the shuffle operation.