# `ld`

[RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v.md) › [Instructions](https://asm-editor.specy.app/documentation/risc-v/instruction.md)

Web page: https://asm-editor.specy.app/documentation/risc-v/instruction/ld

**Load double word** · RV64 only

Category: Load and store

Loads the 64-bit double word at the address in the second register plus an offset into the first.

[RISC-V manual: ld](https://docs.riscv.org/reference/isa/v20260120/unpriv/rv64.html#norm:ld_op_rv64i)

Used in: [Going 64-bit](https://asm-editor.specy.app/learn/courses/risc-v/introduction/going-64-bit.md) (RISC-V assembly)

## Forms

- `ld t1, imm12(t2)`

## Pseudo-instructions

The processor does not have these forms. The assembler replaces each of them with one or more real instructions. Open a row to see them.

Set t1 to contents of effective memory word address

- `ld t1, (t2)`
  - `ld t1,(t2)` → `ld t1, 0(t2)`
- `ld t1, imm`
  - `ld t1,-100` → `ld t1, imm(zero)`
  - `ld t1,10000000` → `lui t1, hi(imm)`; `ld t1, lo(imm)(t1)`

- `ld t1, label` · Set t1 to contents of memory word at label's address
  - `ld t1,label` → `auipc t1, pcrel_hi(label)`; `ld t1, pcrel_lo(label)(t1)`

- `ld t1, %lo(label)(t2)` · Load from Address
  - `ld t1,%lo(label)(t2)` → `ld t1, lo(label)(t2)`

## Operands

- `t1`: Any integer register, `x0` to `x31`, or its named alias, such as `zero`, `t0` or `t6`.
- `imm12`: A signed 12-bit immediate, `-2048` to `2047`.
- `t2`: An integer register. It may be the same register as `t1`.
- `imm`: An immediate value: a signed 12-bit value (`-2048` to `2047`) or a 32-bit value (`-2147483648` to `4294967295`). The size your value needs decides which real instructions the assembler uses. Open the row to see them for each size.
- `label`: A named address in the program, such as the start of a loop or a variable in `.data`.

## Example

```riscv64
# value is initialized and naturally aligned for this operation.
.data
value: .dword 0x0000000012345678
.text
la t0, value
# The initialized doubleword is 0x12345678; ld writes 305419896 to t2.
ld t2, 0(t0)
```
