C.ADDI4SPN

Compressed Add Immediate to Stack Pointer (Non-zero)

C.ADDI4SPN rd', uimm

Adds a zero-extended non-zero immediate to the stack pointer (x2) and stores the result in a register.

Details

Adds a zero-extended non-zero immediate to sp (x2) and writes the result to rd′ (CIW format). Used to address stack-allocated data.

Pseudocode Operation

R[rd'] = R[2] + zext(uimm);

Example

C.ADDI4SPN x8, 16

Encoding

Binary Layout
?
31:16
000
15:13
c_nzuimm10
12:5
rd_p
4:2
00
1:0
 
Format CIW
Opcode 0x00000000
Extension C

Operands

  • rd'
    Dest (x8-x15)
  • uimm
    Unsigned immediate value