absolut
absolut copied to clipboard
Add lookup functions for select ISAs
trafficstars
The SimdTable trait provides a lookup table in the form of two raw byte arrays: SimdTable::LO and SimdTable::HI without any convenient way to use them.
Ideally, lookup function implementations would be provided for SSE, AVX, AVX-512, NEON and SIMD128.
However, the user should be left with the freedom to either (1) not use any of the provided lookup functions or (2) use a lookup function for a specific ISA or (4) use a statically-dispatched lookup function or (5) use a dynamically dispatched lookup function.
Thus the SimdTable trait might look like the following:
trait SimdTable<const N: usize> {
const LO: [usize; N];
const HI: [usize; N];
unsafe fn lookup_sse(output: &mut [u8; N]);
unsafe fn lookup_avx(output: &mut [u8; N]);
unsafe fn lookup_avx512(output: &mut [u8; N]);
unsafe fn lookup_neon(output: &mut [u8; N]);
unsafe fn lookup_sve3(output: &mut [u8; N]);
unsafe fn lookup_simd128(output: &mut [u8; N]);
fn lookup(output: &mut [u8; N]);
fn lookup_dyn(output: &mut [u8; N]);
fn lookup_fallback(output: &mut [u8; N]);
}