adr
Form PC-relative Address
ADR <Xd>, <label>
Calculates the address of a label (PC +/- 1MB range).
Details
Forms a PC-relative address by adding a signed 21-bit offset to the current PC and stores the result in the destination register. The immediate is composed of immhi (19 bits) and immlo (2 bits) and supports label references within ±1 MB. This is an AArch64-only instruction that does not affect condition flags.
Pseudocode Operation
Xd ← PC + SignExtend(immhi:immlo, 21)
Example
ADR x0, label
Encoding
Binary Layout
0
immlo
10000
immhi
Rd
Operands
-
Xd
Destination 64-bit integer register -
label
Label
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x10000000 | ADR <Xd>, <label> | A64 | 0 | immlo | 10000 | immhi | Rd | ||
| 0x04A0A000 | ADR <Zd>.<T>, [<Zn>.<T>, <Zm>.<T>{, <mod> <amount>}] | A64 | 00000100 | 1 | sz | 1 | Zm | 1010 | msz | Zn | Zd | ||
| 0x0420A000 | ADR <Zd>.D, [<Zn>.D, <Zm>.D, SXTW{ <amount>}] | A64 | 00000100 | 0 | 0 | 1 | Zm | 1010 | msz | Zn | Zd | ||
| 0x0460A000 | ADR <Zd>.D, [<Zn>.D, <Zm>.D, UXTW{ <amount>}] | A64 | 00000100 | 0 | 1 | 1 | Zm | 1010 | msz | Zn | Zd |
Description
Form PC-relative address adds an immediate value to the PC value to form a PC-relative address, and writes the result to the destination register.
Operation
X[d, 64] = PC64 + imm;