lwz or l (Load Word and Zero) instruction
Loads a word of data from a specified location in memory into a general-purpose register.
|0 - 5||32|
|6 - 10||RT|
|11 - 15||RA|
|16 - 31||D|
The lwz and l instructions load a word in storage 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 D, a 16-bit, signed two's complement integer sign-extended to 32 bits. If GPR RA is 0, then the EA is D.
The lwz and l instructions have one syntax form and do not affect the Fixed-Point Exception Register or Condition Register Field 0.
|RT||Specifies target general-purpose register where result of operation is stored.|
|D||Specifies a 16-bit, signed two's complement integer sign-extended to 32 bits for EA calculation.|
|RA||Specifies source general-purpose register for EA calculation.|
The following code loads a word from memory into GPR 6:
.csect data[rw] # Assume GPR 5 contains address of csect data[rw]. storage: .long 0x4 .csect text[pr] lwz 6,storage(5) # GPR 6 now contains 0x0000 0004.