Skip to content

Instantly share code, notes, and snippets.

@lenary
Last active July 2, 2026 22:26
Show Gist options
  • Select an option

  • Save lenary/297dcc705ab94633d3afee156db6de6b to your computer and use it in GitHub Desktop.

Select an option

Save lenary/297dcc705ab94633d3afee156db6de6b to your computer and use it in GitHub Desktop.

RISC-V Atomic Extensions

  • A (requires Zaamo, Zalrsc)

AMO-Related

  • Zaamo - Atomic memory operations - AMO*.W, AMO*.D
  • Zabha - AMO for Byte/Halfword - AMO*.B, AMO*.H (requires Zaamo)
  • Zacas - Atomic Compare and Swap - AMOCAS.* (requires Zaamo)

Load/Store Related

  • Zalrsc - Load Reserved / Store Conditional - LR, SC
  • Zalasr - Load-Acquire / Store-Relase - L*.AQ/AQRL, S*.RL/AQRL
  • Zawrs - Wait on Reservation Set - WRS.* (used with Zalrsc)

Total Store Ordering

  • Ztso - Total Store Ordering

Profile-related info only.

  • Za64rs - Reservation Set Size of Max 64 bytes
  • Za128rs - Reservation Set Size of Max 128 bytes
  • Zama16b - "Misaligned loads, stores, and AMOs to main memory regions that do not cross a naturally aligned 16-byte boundary are atomic."

ABIs:

Atomic ABI

  • A7 is any of the mappings
  • A6S is any of the mappings except those with note 3

32- and 64-bit atomic operations have mappings for both Zalrsc and Zaamo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment