3 ms·
In this case it would be nice if operations that are type-safe and don't read or write memory at all, such as mm256_shuffle_epi8, were available in safe rust.
by anonymoushn 4y ago
In this case it would be nice if operations that are type-safe and don't read or write memory at all, such as mm256_shuffle_epi8, were available in safe rust.
- jsheard 4y agoIt's a work in progress, on nightly there is a safe and portable SIMD abstraction under development in std::simd. e.g. "mm256_shuffle_epi8" on X64+AVX2, ARM64+NEON and plain ARM: https://rust.godbolt.org/z/7rjKE93Kn https://rust.godbolt.org/z/7rjKE93Kn It currently only works with constant shuffle masks but dynamic shuffles are on the to-do list.
- anonymoushn 4y agoThis is helpful for the use cases that want to rearrange bytes in a fixed pattern, but it cannot yet express a stream vbyte decoder (out = pshufb(in, shuffle_patterns[len_mask])) or a check for which bytes are in small set of bytes with distinct lower nibbles and the high bit not set (eq(in, pshufb(set, in))) yet. If it's to be portable it needs an extra instruction on one platform or the other because tbl and vpshufb do different things :(