sthbrx
Store Halfword Byte-Reverse Indexed
sthbrx RS, RA, RB
Swaps bytes and stores a halfword.
Details
Byte-reverses the low 16 bits of RS and stores the result as a halfword in memory at address (RA|0) + RB. No status flags are affected. This is used to write halfword data in reversed byte order to memory.
Pseudocode Operation
EA ← (RA|0) + RB
[EA] ← byte_reverse_16(RS[48:63])
Programming Note
The sthbrx instruction is useful for storing a halfword in memory with byte-reversed order. Ensure that the base address register (RA) and index register (RB) are correctly set to avoid incorrect memory addresses. This instruction operates at user privilege level and will raise an exception if the effective address is out of bounds or if there is a protection fault.
Example
sthbrx r3, r4, r5
Encoding
Binary Layout
31
0
RS
6
RA
11
RB
16
918
21
/
31
Operands
-
RS
Source -
RA
Base -
RB
Index