GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/vect Performance Win

Vectorizer records permutation data for costing

Vectorizer now records permutation details for more accurate cost modeling.

GCC’s vectorizer has been enhanced to record permutation information, crucial for accurately costing complex vector operations. New data structures (vect_permute_data, vect_call_data) store permutation constants as trees, allowing the codegen phase to reuse them. This enables targets to query permutes associated with SLP nodes for more precise cost estimations, improving the effectiveness of vectorization, especially for operations like byte swaps.

In Details

This patch introduces vect_permute_data and augments vect_load_store_data and vect_call_data in tree-vectorizer.h. During analysis in tree-vect-slp.cc, permutation constants are built as trees and stored. This data is then used in the codegen phase via vect_transform_slp_perm_load and related functions. The change_layout_cost and internal_node_cost functions are modified to handle this new data. For vectorizable_bswap, vect_call_data is now used to store the bswap permute. Node-specific data is also cleaned up in vect_slp_analyze_node_operations when analysis reverts.

For Context
vectorizer
A compiler component that transforms scalar code into equivalent vector code, using special CPU instructions that operate on multiple data elements simultaneously.
permutation
An operation that rearranges the elements within a vector according to a specific pattern or index.
costing
The process by which a compiler estimates the performance impact (e.g., execution time) of different code options to choose the most efficient one.
SLP (Superword Level Parallelism)
A vectorization technique that identifies and groups independent scalar operations that can be executed in parallel on vector registers.
codegen
Code generation, the phase of a compiler that produces machine code or intermediate code for a target architecture.
Filed Under: gccvectorizationoptimizationcost model