Instruction
AADD
Atomically adds a register to a naturally aligned 32- or 64-bit value in memory without returning anything, as a weakly ordered remote atomic operation.
AADD adds a general-purpose register to a doubleword or quadword in
memory atomically, as lock add does, but returns nothing and keeps
much weaker ordering: it is one of RAO-INT’s remote atomic operations,
which the processor may carry out far from the core, in a shared cache
or at the memory controller. The destination must be memory, naturally
aligned to its size and of the write-back type; a misaligned or non-WB
destination raises #GP. A LOCK prefix raises #UD, and the flags are left
alone. AAND, AOR and AXOR
are the bitwise forms, on the same opcode, 0F38 FC, told apart by the
prefix: none for AADD, then 66, F2 and F3.
Order and fences
Intel gives these operations the ordering of write-combining stores, like MOVNTI’s. One core’s accesses to the same location stay in program order, but an AADD may pass writes and other remote atomics to other addresses, so a set of them may reach memory in any order. Code that needs more uses SFENCE or MFENCE; an LFENCE after an AADD does not hold it back, as AADD loads nothing into the core. Inside a TSX transaction it aborts the transaction.
Where it pays
Intel’s example is a histogram shared by many cores: with
XADD or lock add, a contended bin’s line moves from
core to core for every update, while remote updates meet where the line
already is. The same text warns that reading the location soon after, or
mixing ordinary accesses with the updates, loses the benefit, and that
an implementation may combine updates of one line only when they share
the operation or the size, so mixed updates of a line are better kept
apart in time.
In our builds and on Zen 5
GCC 14 and Clang 23 at -O2 with -mraoint compile _aadd_i32(&c, v) to
aadd dword ptr [rip + c], edi (GCC’s spelling differs) and a histogram
loop over _aadd_i32(&hist[p[i]], 1) to one AADD per byte. Neither
picks it for a relaxed __atomic_fetch_add with the result unused,
which stays lock add. Neither enables it for -march=sierraforest,
grandridge or clearwaterforest, nor Clang 23 for diamondrapids.
The Zen 5 behind this site’s recorded cases reports
CPUID.(EAX=07H,ECX=1):EAX as 30h, without RAO-INT’s bit 3, and both
cases, 32- and 64-bit, raised #UD.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
AADD m32, r32
AADD_MEM32_GPR32 | NP 0F 38 FC /r | RAO_INT |
AADD m64, r64 64-bit mode only
AADD_MEM64_GPR64 | REX.W 0F 38 FC /r | RAO_INT |
AADD m32, r32
AADD_MEMi32_GPR32i32_APX | EVEX.LLZ.NP.MAP4.W0 FC /r | APX_F + RAO_INT |
AADD m64, r64
AADD_MEMi64_GPR64i64_APX | EVEX.LLZ.NP.MAP4.W1 FC /r | APX_F + RAO_INT |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if not cpuid_leaf(7, 1)[0] >> 3 & 1:
fault(UD) # CPUID: no RAO-INT
dest.write(dest + src) # one atomic read-modify-write, weakly
# ordered, unlike LOCK ADD: #GP(0) unless
# dest is aligned to its size and in
# write-back memory; no flag changes
Run on AMD Zen 5 (EPYC 9645): 2 cases. Its cases ran where CPUID reported no RAO-INT, and every one raised an exception. The APX forms were not run: none of these processors has APX.
Operands
| Operand | Kind | Action |
|---|---|---|
AADD m32, r32 AADD m64, r64 64-bit mode only | ||
m32/64 | explicit | read, write |
r32/64 | explicit | read |
Flags
None: XED records no flag that the forms test or change.
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
LEGACY-RAO-INT- EVEX forms
APX-EVEX-RAO-INT
Attributes
What else XED records about the forms. How to read.
- All forms
- always atomic; may abort a TSX transaction
AADD m32, r32- 4-byte aligned memory operand
AADD m64, r6464-bit mode only- 8-byte aligned memory operand
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to AADD, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_aadd_i32
void _aadd_i32(int *__A, int __B) |
|
_aadd_i64
void _aadd_i64(long long *__A, long long __B) |
|
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
RAO_INT | RAO_INT | None in XED’s chip model, which lists these instructions only under its placeholder for future processors. |
APX_F_RAO_INT | APX_F + RAO_INT | None in XED’s chip model, which lists these instructions only under its placeholder for future processors. |
More RAO-INT instructions
More APX instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - Intel Architecture Instruction Set Extensions and Future Features Programming Reference (319433-062, June 2026): page 2-2 (AADD)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The intrinsics and their signatures come from Clang, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.