blrl
Branch to Link Register and Link - 4E 80 00 21
blrl

Instruction Syntax

MnemonicFormatFlags
blrlLK = 1

Instruction Encoding

0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
LK
FieldBitsDescription
Primary Opcode0-5010011 (0x13)
BO6-1001000 (Branch Option)
BI11-1500000 (Branch Input - always)
BD16-2900000000000000 (unused)
LK31Link bit (1)

Operation

NIA ← LR
LR ← CIA + 4

BLRL branches to the address in the Link Register and saves the return address (CIA + 4) in the Link Register.

  1. Sets the next instruction address (NIA) to the value in LR
  2. Stores the return address (CIA + 4) in LR

Note: BLRL is a derived form of the BCLR instruction with LK=1.

Affected Registers

Examples

# Call function pointer and return
mtlr r4      # Set LR to function address
blrl         # Branch to LR and save return address
# ...
blr          # Return

# Tail call optimization
mtlr r5      # Set LR to next function
blrl         # Branch to LR and save return address

Related Instructions

bclr, blr, bl, b

Back to Index