Skip to content

swizzle_dyn: variant where out-of-bounds indices return implementation-defined result #486

Description

@SuperSamus

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.

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

    C-feature-requestCategory: a feature request, i.e. not implemented / a PR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions