What immediate range does C.ADDI encode?
The CI format combines imm[5] and imm[4:0] into a signed 6-bit immediate, so it represents -32 through 31; regular C.ADDI does not use zero.
Regular C.ADDI adds a nonzero sign-extended 6-bit immediate to a nonzero rd: rd += imm. CI format.
Regular C.ADDI uses the CI format to add a nonzero sign-extended 6-bit immediate to a nonzero rd and write rd; it expands to addi rd, rd, imm. Encodings with nonzero rd and imm=0 are HINTs. rd=x0 with imm=0 is C.NOP; C.NOP encodings with nonzero imm are also HINTs.
Decodes the real 16-bit CR or CI encoding and distinguishes normal instructions, HINTs, and shared encodings.
The animation shows C-extension 16-bit fields directly instead of pretending this is a 32-bit scalar instruction.
This has the same calculation as addi rd, rd, imm; C.ADDI differs only in its 16-bit CI encoding and 6-bit immediate.
0x156D = 0001010101101101x10 = 0x00000007
This animation shows only officially defined decode, register reads, arithmetic, and architectural state, not a particular implementation's pipeline, cache, prediction, or timing.
C.ADDI is a 16-bit CI encoding for adding a signed 6-bit immediate to rd itself; the regular instruction form excludes rd=x0 and imm=0.
Understand this scenario with real code like «c.addi x10, 5 # x10 += 5».
Understand this scenario with real code like «c.addi x10, 5 # x10 += 5».
The CI format combines imm[5] and imm[4:0] into a signed 6-bit immediate, so it represents -32 through 31; regular C.ADDI does not use zero.