riscv / riscv-v-spec

Working draft of the proposed RISC-V V vector extension
https://jira.riscv.org/browse/RVG-122
Creative Commons Attribution 4.0 International
961 stars 272 forks source link

shuffles and other horizontal operations #719

Open JishinMaster opened 3 years ago

JishinMaster commented 3 years ago

Dear all, I work on an open source library called simd_utils (https://github.com/JishinMaster/simd_utils), which gives some optimised mathematical functions using SIMD/Vector intrinsics.

I have a few functions using riscv vector extensions and planning to do more. I have trouble finding how to replace sse/neon instructions which do shuffle or horizontal add with riscv vector ones.

Is there a way to do so? Would dedicated instructions be included in a future revision?

jnk0le commented 3 years ago

Shuffling can be done by vrgather or vrgatherei16 (for VLA corectness).

There are horizontal reductions (e.g. sum all elements). "even-odd horizontal" operations are replaced by widening or masking.

jnk0le commented 3 years ago

Dot products etc. are not available yet as those were postponed with ediv.