lwbrx or lbrx (Load Word Byte-Reverse Indexed) instruction

Purpose

Loads a byte-reversed word of data from a specified location in memory into a general-purpose register.

Syntax

Bits Value
0 - 5 31
6 - 10 RT
11 - 15 RA
16 - 20 RB
21 - 30 534
31 /
PowerPC® 
lwbrx RT, RA, RB
POWER® family 
lbrx RT, RA, RB

Description

The lwbrx and lbrx instructions load a byte-reversed word in storage from a specified location in memory addressed by the effective address (EA) into the target general-purpose register (GPR) RT.

Consider the following when using the lwbrx and lbrx instructions:

  • Bits 00-07 of the word in storage addressed by EA are placed into bits 24-31 of GPR RT.
  • Bits 08-15 of the word in storage addressed by EA are placed into bits 16-23 of GPR RT.
  • Bits 16-23 of the word in storage addressed by EA are placed into bits 08-15 of GPR RT.
  • Bits 24-31 of the word in storage addressed by EA are placed into bits 00-07 of GPR RT.

If GPR RA is not 0, the EA is the sum of the contents of GPR RA and GPR RB. If GPR RA is 0, then the EA is the contents of GPR RB.

The lwbrx and lbrx instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.

Parameters

Item Description
RT Specifies target general-purpose register where result of operation is stored.
RA Specifies source general-purpose register for EA calculation.
RB Specifies source general-purpose register for EA calculation.

Examples

The following code loads a byte-reversed word from memory into GPR 6:


storage:  .long 0x0000 ffff
 .
 .
# Assume GPR 4 contains 0x0000 0000.
# Assume GPR 5 contains address of storage.
lwbrx 6,4,5
# GPR 6 now contains 0xffff 0000.