Zen5's AVX512 Uplift
phoronix.com6 ポイント投稿者 Remnant440 コメント
__m512i p0, p1, p2, p3;
p0 = _mm512_load_epi8(lut);
p1 = _mm512_load_epi8(lut + 64);
p2 = _mm512_load_epi8(lut + 128);
p3 = _mm512_load_epi8(lut + 192);
Then, for each SIMD vector of 64 elements, use each lane's value as an index into the lookup table, just like the scalar version. Since we only can use 128 bytes, we DO have to do it twice, once for the lower and again for the upper half, and use a mask to choose between them appropriately on a per-element basis. auto tLow = _mm512_permutex2var_epi8(p0, x, p1);
auto tHigh = _mm512_permutex2var_epi8(p2, x, p3);
You can use _mm512_movepi8_mask to load the mask register. That instruction sets each lane is active if its high bit of the byte is set, which perfectly sets up our table. You could use the mask register directly on the second shuffle instruction or a later blend instruction, it doesn't really matter.