C.J

RISC-V C.J Instruction Details

Instruction ManualC-type

Unconditional jump (±2KiB). CJ format.

Instruction Syntax

c.j offset
Operand Breakdown
Compressed instructions are 16 bits; registers are often limited to x8–x15.
Immediate fields are narrower. Refer to the full encoding for this compressed instruction.
CCompressed Instruction

Instruction Behavior

C.J (CJ format) performs unconditional jump. Sign-extended offset added to pc, ±2 KiB range. Expands to jal x0,offset.

Common Usage Scenarios

Branch & Jump

Understand this scenario with real code like «c.j 128 # jump to pc+128».

Loops & Iteration

Understand this scenario with real code like «c.j 128 # jump to pc+128».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is C-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

Jump range only ±2 KiB (32-bit JAL is ±1 MiB)
Does not save return address
imm=0 encoding is reserved