AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Syntax:          SWP {<cond>}{B} <destination>, <operand1>, [<address>]
Operation:     destination = value from memory at 'address'
          value in memory at 'address' = operand1
Flags:          Unaffected

This instruction swaps a word (or byte) in memory for a word (or byte) in a register,if <destination> and <operand1> are the same register they truly are swapped which is considerably less effort than a sequence of LDRs and STRs with the added advantage that the operation is atomic.

When a word fetch is made from a non-word aligned address, the data will be rotated right by 8 times the value in lower two bits of address. For byte fetches the alignment is unimportant and the upper 24 bits of <destination> are zeroed.

This instruction was introduced in ARM architecture 2A and later.

[sh-index] Back to list of manuals