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

amdgcn: Add zero_extendsidi and extendsidi for better register allocation

Introduces new patterns to improve register allocation for 64-bit extensions on AMD GCN.

New patterns zero_extendsidi and extendsidi have been added for the AMD GCN target. These patterns help register allocation by ensuring that 64-bit values, including those resulting from sign or zero extensions, are maintained in their full width throughout the compilation process, even past the reload stage. This change improves performance, notably yielding speedups in the miniBUDE benchmark.

In Details

This commit introduces zero_extendsidi2 and extendsidi2 to config/gcn/gcn.md. These new patterns aim to improve register allocation by avoiding the use of partially undefined registers that can occur with default lowering strategies. By keeping values as 64-bit throughout, even after reload, they provide a more robust representation and have shown performance improvements in benchmarks like miniBUDE, similar to how vector types were already handled.

For Context
register allocation
The process by which the compiler assigns program variables and intermediate values to the limited number of hardware registers available on the CPU.
reload
A compiler optimization pass that handles register allocation for values that have been spilled to memory and need to be brought back into registers.
miniBUDE
A specific benchmark or test case used to evaluate compiler performance, particularly for the AMD GCN architecture.
zero extension
An operation that extends a smaller integer value to a larger one by prepending zero bits to the most significant part.
sign extension
An operation that extends a smaller integer value to a larger one by replicating the sign bit to the most significant part.
Filed Under: amd gcnregister allocationperformanceoptimization