One of the swizzle variants is defined like this:
|
#[cfg(target_feature = "ssse3")] |
|
16 => transize(x86::_mm_shuffle_epi8, self, zeroing_idxs(idxs)), |
With zeroing_idxs being a function that sets the most significant bit to 1 (so that the result is 0) without touching the relevant least significant bits.
The problem is: there are situations where the user can guarantee that out-of-bounds indices always have the most significant bits set to 1, but there is no way to communicate it to swizzle_dyn, which will always waste performance with zeroing_idxs.
The only way to prevent the inefficiency is with a new function that doesn't call zeroing_idxs in the first place.
Similar situation with avx2_pshufb, which does pretty much the same thing.
Relevant: linebender/fearless_simd#304.
One of the swizzle variants is defined like this:
portable-simd/crates/core_simd/src/swizzle_dyn.rs
Lines 40 to 41 in d7a525f
With
zeroing_idxsbeing a function that sets the most significant bit to 1 (so that the result is 0) without touching the relevant least significant bits.The problem is: there are situations where the user can guarantee that out-of-bounds indices always have the most significant bits set to 1, but there is no way to communicate it to
swizzle_dyn, which will always waste performance withzeroing_idxs.The only way to prevent the inefficiency is with a new function that doesn't call
zeroing_idxsin the first place.Similar situation with
avx2_pshufb, which does pretty much the same thing.Relevant: linebender/fearless_simd#304.