GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
risc-v Performance Win

RISC-V: Fix segment store costing and update segment permute costs

Refines RISC-V vector instruction costs, particularly for segment stores and permutes, improving optimization choices.

This commit rectifies the costing for RISC-V segment store instructions and updates the costs for segment permute operations. Segment store costing was previously inaccurate due to incorrect scaling with group size. The segment permute costs are now aligned with benchmark numbers. These adjustments improve the compiler’s ability to make optimal vectorization decisions, leading to better performance.

In Details

The RISC-V vector cost model has been updated to accurately reflect the performance of segment store and segment permute instructions. The costs::add_stmt_cost function now correctly normalizes the count for store-lanes by group_size, addressing an issue where the cost was incorrectly scaled. Additionally, segment permute costs (rvv_vls_vector_cost and rvv_vla_vector_cost) have been updated to reflect benchmark values. These changes influence SLP vectorization strategies, favoring SLP over LOAD/STORE_LANES in some cases.

For Context
SLP
Superword-Level Parallelism, a compiler optimization that groups independent instructions operating on different data elements into a single vector instruction.
LOAD/STORE_LANES
Instructions used for loading or storing elements from/to a vector register, typically involving multiple individual memory operations.
RISC-V Vector Extension (RVV)
An extension to the RISC-V instruction set architecture that provides support for single instruction, multiple data (SIMD) operations using vector registers.
Filed Under: risc-voptimizationvectorizationperformance