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).

RCWCAS, RCWCASA, RCWCASAL, RCWCASL -- A64

RCWCAS, RCWCASA, RCWCASAL, RCWCASL

Read check write compare and swap doubleword in memory

This instruction reads a 64-bit doubleword from memory, and compares it against the value held in a register. If the comparison is equal, the value in a second register is conditionally written to memory. Storing back to memory is conditional on RCW Checks. If the compare fails or the RCW Checks fail, the architecture permits writing the value read from the location to memory. If the write is performed, the read and the write occur atomically such that no other modification of the memory location can take place between the read and the write. This instruction updates the condition flags based on the result of the update of memory.


Note

This instruction is for performing atomic updates of translation table entries and not for general use.


Integer
(FEAT_THE)

313029282726252423222120191817161514131211109876543210
00011001AR1Rs000010RnRt
S

Encoding for the RCWCAS variant

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

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

Encoding for the RCWCASA variant

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

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

Encoding for the RCWCASAL variant

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

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

Encoding for the RCWCASL variant

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

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

Decode for all variants of this encoding

if !IsFeatureImplemented(FEAT_THE) then EndOfDecode(Decode_UNDEF); end; let s : integer{} = UInt(Rs); let t : integer{} = UInt(Rt); let n : integer{} = UInt(Rn); let soft : boolean = FALSE; let acquire : boolean = A == '1' && t != 31; let release : boolean = R == '1'; let tagchecked : boolean = n != 31;

Assembler Symbols

<Xs>

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

<Xt>

Is the 64-bit name of the general-purpose register to be conditionally stored, 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.


2025-09_rel_asl1 2026-03-12 12:57:38

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