cmpxchg
Compare and Exchange
CMPXCHG r/m, r
Compares accumulator with dest; if equal, dest = src; else accumulator = dest.
Details
The Compare and Exchange instruction compares accumulator with dest; if equal, dest = src; else accumulator = dest.
Pseudocode Operation
// Compares accumulator with dest; if equal, dest = src; else accumulator = dest
Example
CMPXCHG rbx, rax
Encoding
Binary Layout
0F
+0
B1
+1
Operands
-
dest
Register or memory operand -
src
General-purpose register