GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
rs6000

Rs6000: Add future ISA compare and swap equal AMO operations

GCC now supports new PowerPC atomic memory operations for compare-and-swap-equal, anticipating future processor features.

This commit introduces support for upcoming PowerPC compare-and-swap-equal atomic memory operations (AMOs). It adds new enumerations and helper functions, guarded by the _ARCH_FUTURE macro, to enable these operations in rs6000 configurations. For targets not designated as _ARCH_FUTURE, diagnostic stubs will provide compile-time errors, ensuring forward compatibility while preventing accidental use on older hardware.

In Details

This change in gcc/config/rs6000/amo.h extends the PowerPC _AMO_LD enumeration with _AMO_LD_CS_EQ and defines new compare-and-swap helper functions (amo_lwat_cas_eq, etc.). These additions are conditional on _ARCH_FUTURE, indicating support for future ISA extensions. The non-_ARCH_FUTURE error stubs, using _AMO_ERR_CMPSWP, ensure that code leveraging these new AMOs will correctly fail compilation on unsupported architectures, managing the architectural divergence.

For Context

This update to GCC, the GNU Compiler Collection, adds initial support for new features in future PowerPC processors related to 'atomic memory operations' (AMOs). AMOs are low-level CPU instructions that allow multiple parts of a program to modify shared memory locations safely and efficiently, which is critical for concurrent programming. This particular change introduces 'compare-and-swap-equal' AMOs, which are a specialized type of atomic operation that only writes a new value if the current value matches a specific expected value. By implementing these now, GCC is preparing for hardware that isn't yet released, allowing developers to write code that can take advantage of these new, more efficient operations once they become available. The compiler also includes safeguards to ensure that code using these future features won't compile on older PowerPC systems.

Filed Under: powerpcatomic-operationsisafuture-isa