This is a collection of Intel®’ IA32® Software Developer's Manuals (URL of the day) and AMD' AMD64 Architecture Programmer's Manual together with the related specifications, application notes, white papers, and change logs. The collection aims to keep all available revisions. It was originally created by Michal Necasek, see OS/2 Museum.

If you have a public document, related to the IA32® specifications and missing from the collection, please mail it to me. The content of this URL and all sub-ULRs is available for convenient bulk download by rsync x86docs password "" (empty).

SWPT, SWPTA, SWPTAL, SWPTL -- A64

SWPT, SWPTA, SWPTAL, SWPTL

Swap unprivileged

This instruction 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.

For more information about memory ordering semantics, see Load-Acquire, Store-Release.

For information about addressing modes, see Load/Store addressing modes.

Explicit Memory effects produced by the instruction behave as if the instruction was executed at EL0 if the Effective value of PSTATE.UAO is 0 and either:

Otherwise, the Explicit Memory effects operate with the restrictions determined by the Exception level at which the instruction is executed.

Integer
(FEAT_LSUI)

313029282726252423222120191817161514131211109876543210
0sz011001AR1Rs100001RnRt
o3opc

Encoding for the 32-bit SWPT variant

Applies when (sz == 0 && A == 0 && R == 0)

SWPT <Ws>, <Wt>, [<Xn|SP>]

Encoding for the 32-bit SWPTA variant

Applies when (sz == 0 && A == 1 && R == 0)

SWPTA <Ws>, <Wt>, [<Xn|SP>]

Encoding for the 32-bit SWPTAL variant

Applies when (sz == 0 && A == 1 && R == 1)

SWPTAL <Ws>, <Wt>, [<Xn|SP>]

Encoding for the 32-bit SWPTL variant

Applies when (sz == 0 && A == 0 && R == 1)

SWPTL <Ws>, <Wt>, [<Xn|SP>]

Encoding for the 64-bit SWPT variant

Applies when (sz == 1 && A == 0 && R == 0)

SWPT <Xs>, <Xt>, [<Xn|SP>]

Encoding for the 64-bit SWPTA variant

Applies when (sz == 1 && A == 1 && R == 0)

SWPTA <Xs>, <Xt>, [<Xn|SP>]

Encoding for the 64-bit SWPTAL variant

Applies when (sz == 1 && A == 1 && R == 1)

SWPTAL <Xs>, <Xt>, [<Xn|SP>]

Encoding for the 64-bit SWPTL variant

Applies when (sz == 1 && A == 0 && R == 1)

SWPTL <Xs>, <Xt>, [<Xn|SP>]

Decode for all variants of this encoding

if !IsFeatureImplemented(FEAT_LSUI) then EndOfDecode(Decode_UNDEF); end; let s : integer{} = UInt(Rs); let t : integer{} = UInt(Rt); let n : integer{} = UInt(Rn); let datasize : integer{} = 32 << UInt(sz); let regsize : integer{} = if datasize == 64 then 64 else 32; let acquire : boolean = A == '1' && Rt != '11111'; let release : boolean = R == '1'; let tagchecked : boolean = n != 31;

Assembler Symbols

<Ws>

Is the 32-bit name of the general-purpose register to be stored, encoded in the "Rs" field.

<Wt>

Is the 32-bit name of the general-purpose register to be loaded, encoded in the "Rt" field.

<Xn|SP>

Is the 64-bit name of the general-purpose base register or stack pointer, encoded in the "Rn" field.

<Xs>

Is the 64-bit name of the general-purpose register to be stored, encoded in the "Rs" field.

<Xt>

Is the 64-bit name of the general-purpose register to be loaded, encoded in the "Rt" field.

Operation

var address : bits(64); var data : bits(datasize); var store_value : bits(datasize); let privileged : boolean = AArch64_IsUnprivAccessPriv(); let accdesc : AccessDescriptor = CreateAccDescAtomicOp(MemAtomicOp_SWP, acquire, release, tagchecked, privileged, t, s); if n == 31 then CheckSPAlignment(); address = SP{64}(); else address = X{64}(n); end; store_value = X{datasize}(s); let comparevalue : bits(datasize) = ARBITRARY : bits(datasize); // Irrelevant when not executing CAS data = MemAtomic{datasize}(address, comparevalue, store_value, accdesc); X{regsize}(t) = ZeroExtend{regsize}(data);


2026-03_rel 2026-03-26 20:48:11

Copyright © 2010-2026 Arm Limited or its affiliates. All rights reserved. This document is Non-Confidential.