bc
Branch Conditional
Preliminary PPC440x5 CPU Core User’s Manual
instrset.fm.
September 12, 2002 Page 269 of 589
bc
Branch Conditional
if BO2= 0 then
CTR CTR – 1
if (BO2= 1 ((CTR = 0) = BO3)) (BO0=1(CRBI =BO1)) then
if AA = 1 then
BD target16:29
NIA EXTS(BD || 20)
else
BD (target – CIA)16:29
NIA CIA + EXTS(BD || 20)
else
NIA CIA + 4
if LK = 1 then
(LR) CIA + 4
PC NIA
If BO2 contains 0, the CTR decrements, and the decremented value is tested for 0 as part of the branch
condition. In this case, BO3indicates whether the test for 0 must be true or false in order for the branch to be
taken. If BO2 contains 1, then the CTR is neither decremented nor tested as part of the branch condition.
If BO0contains 0, then the CR bit specified by the BI field is compared to BO1as partof the branch condition.
If BO0 contains 1, then the CR is not tested as part of the branch condition, and the BI field is ignored.
The next instruction address (NIA) is either the effective address of the branch target, or the address of the
instruction after the branch, depending on whether the branch is taken or not. The branch target address is
formed by adding a displacement to a base address. The displacement is obtained by concatenating two 0-
bits to the right of the BD field and sign-extending the result to 32 bits.
If the AA field contains 0, the base address is the address of the branch instruction, which is the current
instruction address (CIA). If the AA field contains 1, the base address is 0.
BO4 affects branch prediction, a performance-improvement feature. See Branch Prediction on page65 for a
complete discussion.
Instruction execution resumes with the instruction at the NIA.
If the LK field contains 1, then (CIA + 4) is placed into the LR.
Registers Altered
CTR if BO2 contains 0
LR if LK contains 1
bc BO, BI, target AA=0, LK =0
bca BO, BI, target AA=1, LK =0
bcl BO, BI, target AA=0, LK =1
bcla BO, BI, target AA=1, LK =1
16 BO BI BD AA LK
0 6 11 16 30 31