RISC-V vector extracts use generic vec_perm_const for simplification
RISC-V vector subvector extraction now uses the generic vec_perm_const, eliminating special cases and relying on permute operations.
This commit refactors RISC-V vector subvector extraction by introducing a vec_perm_const recognizer. This allows arbitrary vector pieces to be extracted using a permute operation, removing several special-case vec_extract patterns. The change simplifies the RISC-V vector backend by relying on generic permutation logic, which is expected to streamline the code and potentially improve maintainability. Test cases for subregister extraction have been updated to reflect this new approach.
In Details
This change affects the RISC-V vector extension (riscv-v) implementation within GCC. It introduces a new pattern recognizer, expand_vec_perm_const_1, that leverages vec_perm_const to handle subvector extractions. Previously, specific vec_extract patterns for different subvector sizes (e.g., v_half, vls_quarter) were maintained in autovec.md. This commit removes those specialized patterns and the expand_vector_subreg_extract function, unifying subvector extraction under the more general vec_perm_const mechanism. This is achieved by modifying riscv-v.cc to use a new `shuffle…
- vec_perm_const
- An intermediate representation (IR) intrinsic that represents a constant permutation of elements within vector registers. It's a general-purpose operation for rearranging vector data.
- subvector extraction
- The process of selecting and extracting a smaller portion (a subvector) from a larger vector register.
- RISC-V vector extension (RVV)
- An extension to the RISC-V ISA that provides support for vector processing, enabling Single Instruction, Multiple Data (SIMD) operations on vectors of data.
- autovec.md
- A GCC machine description file (
.md) that specifies instruction patterns and recognition rules for automatic vectorization, often including vector extract operations. - optab
- Short for 'operation table', a data structure in GCC that maps generic operations to specific machine instructions.