Skip to content

Selecting batch type to work with given a register size constraint? #1085

Closed
@Andersama

Description

@Andersama

I'm seeing a lot of code examples which make use of the flexibility of determining the architecture or setting it at compile time. I was curious if there was a way to hint or specify the size of register that I'm expecting the api to be able to use instead.

This is namely to do with the swizzle operations. I've got an algorithm that only really needs to work with the 128 bit wide registers.

//so it seems a bit strange to do:
xsimd::batch<uint8_t, xsimd::ssse3> mask;
//to potentially make use of
template <class A>
XSIMD_INLINE batch<uint8_t, A> swizzle(batch<uint8_t, A> const& self, batch<uint8_t, A> mask, requires_arch<ssse3>) noexcept
{
    return _mm_shuffle_epi8(self, mask);
}
//when I'd also want to make sure that this algorithm works on other architectures

I'm imagining something like this would make sense?

xsimd::batch<uint8_t, xsimd::register_width_128> mask;

Let me know if I'm missing something in the library that'd let me do this.

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