bclr
Branch Conditional to Link Register
bclrl BO,BI,BH
Branches to the address in the Link Register (LR) if the condition is met. Used for function returns.
Details
The bclr instruction branches conditionally to the address contained in the link register (LR). The target address is specified by the BH field and the link register. If the condition specified by the BO field is true, the program counter (CTR) is decremented, and the branch occurs.
Pseudocode Operation
if (64-bit mode) then M ←0 else M ←32
if ¬BO2 then CTR ←CTR - 1
ctr_ok ←BO2 | ((CTRM:63 ≠ 0) ⊕BO3)
cond_ok ←BO0 | (CRBI+32 ≡BO1)
if ctr_ok & cond_ok then NIA ←iea LR0:61 || 0b00
if LK then LR ←iea CIA + 4
Programming Note
bclr, bclrl, bcctr, and bcctrl each serve as both a basic and an extended mnemonic. The Assembler will recognize a bclr, bclrl, bcctr, or bcctrl mnemonic with three operands as the basic form, and a bclr, bclrl, bcctr, or bcctrl mnemonic with two operands as the extended form. In the extended form the BH operand is omitted and assumed to be 0b00.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| bcctr | |
| bltctr | |
| bnectr | |
| bclr | |
| bltlr | |
| bnelr | |
| bdnzlr | |
| bcctr | |
| bcctrl | |
| bclr 4,6 | |
| bnelr cr2 |
Example
Encoding
Operands
-
BO
Branch Options -
BI
CR Bit Index -
BH
Hint bits -
LK
Link Register Update field