Is it always equivalent to a same-named 32-bit instruction?
Not always. Some C/Zc instructions compress common 32-bit operations, while others have dedicated stack-frame or table-jump semantics.
Add zero-extended non-zero imm scaled by 4 to sp, result to rd'. CIW format.
C.ADDI4SPN (CIW format) adds zero-extended non-zero immediate scaled by 4 to sp(x2), writes to rd' (x8-x15 only). Expands to addi rd',x2,nzuimm[9:2]. Valid only when nzuimm≠0. Used to generate pointers to stack-allocated variables.
C.ADDI4SPN is the 16-bit encoding form for compressed add sp plus nonzero immediate; its semantics and encodable register/immediate ranges must be read from the official C extension rules.
Understand this scenario with real code like «c.addi4spn x8, 16 # x8 = sp+16».
Understand this scenario with real code like «c.addi4spn x8, 16 # x8 = sp+16».
Not always. Some C/Zc instructions compress common 32-bit operations, while others have dedicated stack-frame or table-jump semantics.
Many 16-bit encodings can represent only a compressed register subset or fixed registers such as sp, ra, a0/a1.