blrl
Branch to Link Register and Link - 4E 80 00 21
blrl
Instruction Syntax
Mnemonic | Format | Flags |
blrl | LK = 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
Field | Bits | Description |
Primary Opcode | 0-5 | 010011 (0x13) |
BO | 6-10 | 01000 (Branch Option) |
BI | 11-15 | 00000 (Branch Input - always) |
BD | 16-29 | 00000000000000 (unused) |
LK | 31 | Link 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.
- Sets the next instruction address (NIA) to the value in LR
- Stores the return address (CIA + 4) in LR
Note: BLRL is a derived form of the BCLR instruction with LK=1.
Affected Registers
- LR (Link Register) - updated with return address
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