ld (Load Doubleword) instruction
Purpose
Load a doubleword of data into the specified general purpose register.
Syntax
Bits | Value |
---|---|
0 - 5 | 58 |
6 - 10 | RT |
11 - 15 | RA |
16 - 29 | DS |
30 - 31 | 0b00 |
Description
The ld instruction loads a doubleword in storage from a specified location in memory addressed by the effective address (EA) into the target general-purpose register (GPR) RT.
DS is a 14-bit, signed two's complement number, which is sign-extended to 64 bits, and then multiplied by 4 to provide a displacement Disp. If GPR RA is not 0, the EA is the sum of the contents of GPR RA and Disp. If GPR RA is 0, then the EA is Disp.
Parameters
Item | Description |
---|---|
RT | Specifies target general-purpose register where result of operation is stored. |
Disp | Specifies a 16-bit signed number that is a multiple of 4. The assembler divides this number by 4 when generating the instruction. |
RA | Specifies source general-purpose register for EA calculation. |
Examples
The following code loads a doubleword from memory into GPR 4:
.extern mydata[RW]
.csect foodata[RW]
.local foodata[RW]
storage: .llong mydata # address of mydata
.csect text[PR]
# Assume GPR 5 contains address of csect foodata[RW].
ld 4,storage(5) # GPR 4 now contains the address of mydata.
Implementation
This instruction is defined only for 64-bit implementations. Using it on a 32-bit implementation will cause the system illegal instruction error handler to be invoked.