bc

Branch Conditional

bc BO,BI,target_addr (AA=0 LK=0)
bc BO,BI,target_addr (AA=1 LK=0)
bc BO,BI,target_addr (AA=0 LK=1)
bc BO,BI,target_addr (AA=1 LK=1)

Branches conditionally based on the Count Register (CTR) and/or a bit in the Condition Register (CR).

Details

The bc instruction branches to a target address if the specified condition is met.

Pseudocode Operation

if (CR[BI] == condition specified by BO) then
    PC <- target_addr

Programming Note

The bc instruction branches to a target address based on the condition bits in the Condition Register (CR). Ensure that the branch condition and target address are correctly set. The instruction operates at user privilege level, but care must be taken with conditional logic to avoid unintended execution paths.

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

Example

bc 12, 2, label

Encoding

Binary Layout
10
6
BO
21
BI
16
AA
1
LK
0
target_addr
2
 
Format B-form
Opcode 0x40000000
Extension Base
Registers Altered LR, CTR

Operands

  • BO
    Branch Options (5 bits)
  • BI
    CR Bit Index (5 bits)
  • BD
    14-bit Signed Displacement
  • target_addr
    Target address