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
 
Format U-Type
Opcode 0x00000013
Extension Pseudo

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

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;