Why does c.subw have register restrictions?
Many C formats encode registers with shorter fields, so some forms can access only x8..x15 or fixed registers.
32-bit subtract with sign-extend to 64. CA format, RV64C.
c.subw is an RV64C CA-format instruction. It subtracts rs2' from rd' as a 32-bit value, sign-extends bit 31 to XLEN, and writes rd'.
c.subw is an RV64C CA-format instruction. It subtracts rs2' from rd' as a 32-bit value, sign-extends bit 31 to XLEN, and writes rd'.
Understand this scenario with real code like «c.subw 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.