Why does c.addw have register restrictions?
Many C formats encode registers with shorter fields, so some forms can access only x8..x15 or fixed registers.
32-bit add with sign-extend to 64. CA format, RV64C.
c.addw is an RV64C CA-format instruction. It adds rd' and rs2' as 32-bit values, sign-extends bit 31 to XLEN, and writes rd'.
c.addw is an RV64C CA-format instruction. It adds rd' and rs2' as 32-bit values, sign-extends bit 31 to XLEN, and writes rd'.
Understand this scenario with real code like «c.addw x8, x9 # x8 = sext_w(x8+x9)».
Many C formats encode registers with shorter fields, so some forms can access only x8..x15 or fixed registers.
No. It is a 16-bit encoded instruction defined by the C extension.