ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

c.lui

T1 riscv alu insn
Load Upper Immediate
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 Zca, Zkt-DIT
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsZca, Zkt-DIT

Summary

C.LUI loads the non-zero 6-bit immediate field into bits 17-12 of the destination register, clears the bottom 12 bits, and sign-extends bit 17 into all higher bits of the destination. C.LUI expands into lui xd, imm. C.LUI is only valid when xd≠x0 and xd≠x2, and when the immediate is not equal to zero. The code points with imm=0 are reserved; the remaining code points with xd=x0 are HINTs; and the remaining…

Syntax / Encoding

c.lui xd, imm | 011xxxxxxxxxxx01 (mask=0xe003 match=0x6001)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
16RV011xxxxxxxxxxx010xe003 / 0x6001

Operands

NameDescription
immbits [12,6:2], sign-extended, shifted << 12
xdbits [11:7], not [0, 2]

Reference Notes

C.LUI loads the non-zero 6-bit immediate field into bits 17-12 of the destination register, clears the bottom 12 bits, and sign-extends bit 17 into all higher bits of the destination.
C.LUI expands into `lui xd, imm`.
C.LUI is only valid when xd&ne;x0 and xd&ne;x2, and when the immediate is not equal to zero.
The code points with imm=0 are reserved; the remaining code points with xd=x0 are HINTs; and the remaining code points with xd=x2 correspond to the C.ADDI16SP instruction