17.134 SWPA, SWPAL, SWP, SWPL, SWPAL, SWP, SWPL

Swap word or doubleword in memory.

Syntax

SWPA Ws, Wt, [Xn|SP] ; 32-bit, acquire

SWPAL Ws, Wt, [Xn|SP] ; 32-bit, acquire and release

SWP Ws, Wt, [Xn|SP] ; 32-bit, no memory ordering

SWPL Ws, Wt, [Xn|SP] ; 32-bit, release

SWPA Xs, Xt, [Xn|SP] ; 64-bit, acquire

SWPAL Xs, Xt, [Xn|SP] ; 64-bit, acquire and release

SWP Xs, Xt, [Xn|SP] ; 64-bit, no memory ordering

SWPL Xs, Xt, [Xn|SP] ; 64-bit, release

Where:

Ws
Is the 32-bit name of the general-purpose register to be stored.
Wt
Is the 32-bit name of the general-purpose register to be loaded.
Xn|SP
Is the 64-bit name of the general-purpose base register or stack pointer.
Xs
Is the 64-bit name of the general-purpose register to be stored.
Xt
Is the 64-bit name of the general-purpose register to be loaded.

Architectures supported

Supported in ARMv8.1 and later.

Usage

Swap word or doubleword in memory atomically loads a 32-bit word or 64-bit doubleword from a memory location, and stores the value held in a register back to the same memory location. The value initially loaded from memory is returned in the destination register.

  • If the destination register is not one of WZR or XZR, SWPA and SWPAL load from memory with acquire semantics.
  • SWPL and SWPAL store to memory with release semantics.
  • SWP has no memory ordering requirements.

For more information about memory ordering semantics see Load-Acquire, Store-Release in the ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile.

For information about memory accesses see Load/Store addressing modes in the ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile.

Non-ConfidentialPDF file icon PDF versionARM 100069_0608_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.