Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to permute a rust simd vector by another variable vector?

Tags:

rust

simd

Ok. So I've recently started learning rust by rewriting my program to rust though I might have started too hard because I am using portable simd module in rust and I am having restless nights of finding functions to use. Today I tried looking for a way to permute i8x16 vector by another i8x16 vector, like a _mm_shuffle_epi8 from SSE, but sadly didn't find anything.

Please help me find function from std::simd to permutate vector by another variable vector.

Preferably as fast as possible and I want to keep it SSE or AVX but not AVX2 or bigger.

like image 833
FireTner Avatar asked Sep 15 '26 17:09

FireTner


1 Answers

Based on this issue, it is not yet implemented for std::simd: Introduce "dynamic swizzling" into LLVMIR and Rust intrinsics.

For now, you will have to resort to calling std::arch::{x86,x86_64}::_mm_shuffle_epi8 (or whatever you were after) manually, with cfg-wrapping of course if you want it to stay portable.

like image 74
kmdreko Avatar answered Sep 18 '26 06:09

kmdreko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!