Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save 2 instructions in vec32cb &load_bits(uint32_t) & co. #81

Open
jfaure opened this issue Jan 14, 2024 · 0 comments
Open

Save 2 instructions in vec32cb &load_bits(uint32_t) & co. #81

jfaure opened this issue Jan 14, 2024 · 0 comments

Comments

@jfaure
Copy link

jfaure commented Jan 14, 2024

skips setzero() and ~i

// avx512 _mm256_movm_epi8 emulation
__m256i emu_mm256_movm_epi8(uint32_t i) {
  __m256i rep8Bytes = _mm256_shuffle_epi8(_mm256_set1_epi32(i) // dup each byte of i 8 times
     , _mm256_setr_epi64x(0,0x0101010101010101,0x0202020202020202,0x0303030303030303));
  __m256i m = _mm256_set1_epi64x(0x8040201008040201); // repeat 4  [0b10000000 , 0b010000000 .. 0b1]
  __m256i r = _mm256_and_si256(rep8Bytes , m);
  return _mm256_cmpeq_epi8(r , m);
}```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant