lwbrx
Load Word Byte-Reverse Indexed
lwbrx RT, RA, RB
Loads a word and swaps bytes.
Encoding
Binary Layout
31
0:5
RT
6:10
RA
11:15
RB
16:20
534
21:30
/
31
Operands
-
RT
Target -
RA
Base -
RB
Index
Example
lwbrx r3, r4, r5
Related
Across architectures
Byte Swap (Endianness Reversal) : how x86, ARM, RISC-V, and PowerISA each do this.
More in Base
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.