Is immediate zero a no-op?
No. imm=0 still sign-extends the low 32 bits to 64. For example, 0x0000000080000000 becomes 0xFFFFFFFF80000000.
RV64 only: add a signed 6-bit immediate to rd, then sign-extend the low 32 bits to 64; rd=x0 is reserved.
C.ADDIW is a 16-bit CI instruction in C 2.0 / Zca, available only on RV64. rd is both source and destination and must be x1–x31; imm ranges from -32 through 31. Keep the low 32 bits of rd+imm and sign-extend bit 31 to 64 bits; overflow raises no arithmetic exception. It is equivalent to addiw rd, rd, imm. imm=0 is valid and performs sext.w rd, rd, rather than a HINT.
Explore the 16-bit encoding, operands, calculation, and architectural result.
RV64C / Zca, XLEN=64
16-bit encoding fields
RV64 only: add a signed 6-bit immediate to rd, then sign-extend the low 32 bits to 64; rd=x0 is reserved.
RV64, x10=0x0000000080000000: c.addiw x10, -1 gives x10=0x000000007fffffff, sign-extending the low 32-bit sum.
No. imm=0 still sign-extends the low 32 bits to 64. For example, 0x0000000080000000 becomes 0xFFFFFFFF80000000.
No. C.ADDIW code points with rd=x0 are reserved. Valid rd values are x1–x31.