Skip to content

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

Open

Description

@jfaure

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);
}```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions