C.LUI

Compressed Load Upper Immediate

C.LUI rd, imm

Loads a non-zero 6-bit immediate into bits 17-12 of the destination register, clears lower 12 bits, sign-extends bit 17.

Details

Loads a 18-bit sign-extended value (upper 6 bits of 20-bit immediate) into rd (≠ x0, x2).

Pseudocode Operation

R[rd] = sext(imm << 12);

Example

C.LUI x10, 1

Encoding

Binary Layout
011
15:13
imm
rd
12:8
imm
01
7:6
 
Format CI
Opcode 01
Extension C

Operands

  • rd
    Destination register (integer)
  • imm
    Signed immediate value