wide icon indicating copy to clipboard operation
wide copied to clipboard

Feature request: shuffle methods

Open RReverser opened this issue 10 months ago • 4 comments

Looks like LLVM autovectorizer struggles with turning array operations into shuffles, so direct control would be very welcome. This would be particularly useful for things like bitonic sorting.

RReverser avatar Feb 22 '25 22:02 RReverser

I'd love to have this. I think the shuffle pattern has to be a const value on x86, which might make it awkward, but even so it's a good idea.

If someone does the PR I'll try to review it as quickly as possible.

Lokathor avatar Feb 22 '25 22:02 Lokathor

I think the shuffle pattern has to be a const value on x86

Yeah, IIRC stdlib intrinsics solve this by taking such params (in shuffle and other ops with similar restriction) via const generics.

Same should work here.

RReverser avatar Feb 22 '25 23:02 RReverser

What stable intrinsics would this translate to? Sadly most of the < 32 bit shuffle intrinsics are kind of special case

mcroomp avatar Mar 04 '25 07:03 mcroomp

presumably these ones: https://docs.rs/safe_arch/latest/safe_arch/?search=shuffle

Lokathor avatar Mar 04 '25 21:03 Lokathor