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

AMDGCN: Implement vector memory loads/stores

AMDGCN backend now uses conventional vector loads/stores instead of gather/scatter for improved memory handling.

The AMDGCN backend has been refactored to natively support vector memory loads and stores using the (mem (reg:<vecmode>)) construct. This replaces less efficient gather/scatter operations, allowing for more conventional representation of vector memory accesses. While masked loads still require a workaround due to potential reloads, this change improves the representation of unconditional vector loads and stores.

In Details

This patch refactors the AMDGCN backend's memory handling to support (mem (reg:<vecmode>)) operands, enabling direct vector loads and stores. Previously, vector loads/stores were approximated using gather/scatter UNSPECs. This change replaces those UNSPECs with general mov instructions for vector memory operations, simplifying the RTL and improving how vector memory accesses are represented. Constraints for address registers (Rf, Rm, etc.) are updated to accommodate vector modes.

For Context
AMDGCN
A graphics processor architecture developed by AMD, used in their Radeon GPUs. GCC's AMDGCN backend targets this architecture.
vector memory loads/stores
Memory operations that read or write multiple data elements (a vector) from or to memory in a single instruction.
gather/scatter
Specialized memory operations that load or store vector elements from/to non-contiguous memory locations specified by a vector of addresses.
RTL
Register Transfer Language. An intermediate representation used within GCC, consisting of a set of generic tree-like data structures that represent the flow of data and operations within a program.
UNSPEC
An intermediate representation in GCC's RTL (Register Transfer Language) used to represent operations that do not have a direct machine instruction mapping, often custom or backend-specific.
LRA
Local Register Allocation. A phase in the compiler's backend that assigns program variables to machine registers.
Filed Under: amdgcngpumemoryoptimization