In AVX, is there any special macro that helps to construct the immediate constant for _mm256_shuffle_* intrinsics, like _MM_SHUFFLE(..) for its SSE counterpart? I can't find any.
You still use _MM_SHUFFLE() for shuffles that take the control input as an 8bit immediate. e.g. _mm256_shuffle_epi32 (vpshufd) does the same shuffle on both lanes.
_MM_SHUFFLE(dd,cc,bb,aa) just packs the low 2 bits of each arg into a 0bddccbbaa.
You can write _MM_SHUFFLE(1,1,1,1) (broadcast element 1) as 0b01010101, i.e. 0x55.
You can use C++14 separators (or whatever they're called) to write it as 0b01'01'01'01 for better human-readability, esp. in cases where each element is different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With