CSWAP

Name:

CSWAP $X,$Y,$Z

Specification:

If u(M8[$Y + $Z]) = rP
then u(M8[$Y + $Z]) ← $X and $X ← 1
otherwise rP ← u(M8[$Y + $Z]) and $X ← 0

Timing:

2υ + 2μ

Description:

Compare and Swap. Compare the octabyte at the address $Y+$Z (or $Y+Z) with the content of the prediction register rP. If both are equal, store $X at the given address and set $X to 1, otherwise load the value from the given address into rP and set $X to 0.

This is an atomic operation, and therefore suitable to synchronize processes using memory locations.