SIMD.jl/shufflevector without support for SIMD vector as mask?

Hi!
Could anybody explain a bit on why SIMD.jl/shufflevector does not accept a Vec{N, T} object as “mask” argument.
Wouldn’t it be a natural choice to allow “mask” to be a SIMD vector?
Is this an LLVM limitation?
Is this even a common use case?

I think this is an LLVM limitation:

https://llvm.org/docs/LangRef.html#shufflevector-instruction

It could probably be worked around, at the cost of no longer being architecture agnostic.

1 Like

VectorizationBase supports it, but only for CPUs with AVX512 and 8 x f64: VectorizationBase.jl/src/special/exp.jl at cbf6789a17f3bd26bc555fc03423b877e740dee7 · JuliaSIMD/VectorizationBase.jl · GitHub
16 x f32 would be easy to ads following that approach.

Runtime shuffles are nice if you want to implement small-but-fast lookup tables.

2 Likes