bctar

Branch Conditional to Target Address Register

bctar BO,BI,BH (LK=0)

Conditional branch based on the contents of the Condition Register and the Count Register.

Details

The bctar instruction branches conditionally to the address in the TAR register if certain conditions are met. The BO, BI, and BH fields determine these conditions. If LK is set, the Link Register (LR) is updated with the address of the next instruction.

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 TAR0:61 || 0b00
if LK then
    LR ←iea CIA + 4

Programming Note

In some systems, the system software will restrict usage of the bctar[l] instruction to only selected programs. If an attempt is made to execute the instruction when it is not available, the system error handler will be invoked.

Example

bctar 20, 0, BH (LK=0)

Encoding

Binary Layout
19
0
BO
6
BI
11
/
16
BH
19
560
21
/
31
 
Format XL-form
Opcode 0x4C000460
Extension Base
Registers Altered CTR, LR

Operands

  • BO
    Options
  • BI
    CR Bit
  • BH
    Hint