LI
Load Immediate
LI rd, imm
Loads an arbitrary immediate value into a register.
Encoding
Binary Layout
imm[31:12]
31:12
rd
11:7
0110111
6:0
Operands
-
rd
Destination register (integer) -
imm
Immediate Value
Example
LI x5, 0x12345
// Expands to: LUI x5, 0x12; ADDI x5, x5, 0x345
Related
More in Pseudo
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
LI loads an arbitrary immediate value into rd using one or two instructions (LUI+ADDI for 32-bit, or longer for 64-bit). It is an assembler pseudoinstruction.
Operation
R[rd] = imm;