aarch64: Add support for FEAT_CMH atomic_fetch intrinsics
AArch64 support added for new atomic fetch operations with hints using FEAT_CMH extension.
GCC now supports new atomic fetch-with-hint intrinsics for the AArch64 architecture, leveraging the FEAT_CMH extension. This addition enables the use of new hints like SHUH and SHUH PH for atomic operations such as fetch-and-add, fetch-and-sub, fetch-and-or, fetch-and-xor, and fetch-and-and. Corresponding test cases have been added.
In Details
Support for the AArch64 FEAT_CMH extension has been added, specifically for atomic fetch operations with hints. New builtins like __arm_atomic_fetch_add_with_hint and others (for sub, and, or, xor) are defined in arm_acle.h. The aarch64-builtins.cc file is updated to handle these new intrinsics, including their expansion and overload resolution. New patterns in atomics.md and test cases are provided to cover these fetch-with-hint operations.
- AArch64
- The 64-bit ARM architecture instruction set.
- Atomic operation
- An operation that is guaranteed to be performed indivisibly, ensuring that it completes entirely without interruption from other threads or processes. Crucial for concurrent programming.
- Intrinsic
- A special function provided by a compiler that maps directly to a specific hardware instruction or a small sequence of instructions. They offer performance benefits by bypassing function call overhead.
- FEAT_CMH
- A specific feature extension for the AArch64 architecture, providing new instructions and hints for enhanced performance, particularly in atomic operations.
- SHUH / SHUH PH
- Specific hints introduced by the FEAT_CMH extension on AArch64, which can be used with atomic operations to potentially improve performance by influencing memory ordering or cache behavior.
- Fetch-and-add/sub/etc.
- A type of atomic operation that reads the current value of a memory location, performs an arithmetic or logical operation on it, and then writes the result back, all as a single, indivisible step.