lwzx or lx (Load Word and Zero Indexed) instruction
Purpose
Loads a 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 | 23 |
31 | / |
Description
The lwzx and lx instructions load a word of data from a specified location in memory, addressed by the effective address (EA), into the target general-purpose register (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 lwzx and lx 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 word from memory into GPR 6:
.csect data[rw]
.long 0xffdd 75ce
# Assume GPR 4 contains the displacement relative to
# csect data[rw].
# Assume GPR 5 contains the address of csect data[rw].
.csect text[pr]
lwzx 6,5,4
# GPR 6 now contains 0xffdd 75ce.