JALR

Jump and Link Register

JALR rd, offset(rs1)

Jumps to address in rs1 + offset, saving return address to rd.

Details

JALR (Jump and Link Register) computes a target address by adding the sign-extended 12-bit immediate to rs1, then clears the least-significant bit of the result. It writes the address of the following instruction (PC+4) to rd, then jumps to the target.

Pseudocode Operation

t = PC + 4; PC = (R[rs1] + sext(offset)) & ~1; R[rd] = t;

Example

JALR x0, 0(x1)

Encoding

Binary Layout
imm[11:0]
31:20
rs1
19:15
000
14:12
rd
11:7
1100111
6:0
 
Format I-Type
Opcode 0x67
Extension RV32I

Operands

  • rd
    Return Address Dest
  • rs1
    Base Address
  • offset
    12-bit Immediate