stwbrx
Store Word Byte-Reverse Indexed
Swaps bytes and stores a word.
Details
Byte-reverses the low 32 bits of RS and stores the result as a word in memory at address (RA|0) + RB. No status flags are affected. This instruction is used for writing word-sized data in reversed byte order.
Pseudocode Operation
EA ← (RA|0) + RB
[EA] ← byte_reverse_32(RS[32:63])
Programming Note
The stwbrx instruction is useful for storing a word in memory with its byte order reversed, which can be necessary for compatibility with systems that use different endianness. Ensure that the effective address (EA) calculated from registers RA and RB is properly aligned to avoid alignment exceptions. This instruction operates at user privilege level but will raise an exception if the EA is out of bounds or if there are insufficient permissions.
Example
Encoding
Operands
-
RS
Source -
RA
Base -
RB
Index