Intel® C++ Compiler 19.0 Developer Guide and Reference
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.
extern __m256i _mm256_shuffle_epi8(__m256i a, __m256i b); |
a |
integer source vector |
b |
integer source vector |
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)];
}
}Result of the shuffle operation.