lwbrx
Load Word Byte-Reverse Indexed
Loads a word and swaps bytes.
Details
Loads a word (32-bit value) from memory at address (RA|0) + RB, byte-reverses it, and stores the result in RT. No status flags are affected. This instruction is used for converting word-sized data between big-endian and little-endian formats.
Pseudocode Operation
EA ← (RA|0) + RB
RT ← byte_reverse_32([EA])
Programming Note
The lwbrx instruction is commonly used to load a word from memory and reverse its byte order, which can be useful for handling data in big-endian or little-endian formats. Ensure that the base address (RA) and index (RB) registers are correctly set to avoid incorrect memory access. This instruction operates at user privilege level and will raise an exception if it accesses invalid memory addresses.
Example
Encoding
Operands
-
RT
Target -
RA
Base -
RB
Index