
7-18
G2 PowerPC Core Reference Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
Execution Unit Timings
CR; if the CTR condition is sufficient to resolve the branch, then a CR-dependency
is ignored.)
A
bc
(CTR) followed by another
bc
(CTR)—Fetching is stopped, and the second
branch waits for the first to be completed.
A
bc
(CTR) followed by a
bcctr
—Fetching is stopped, and the
bcctr
waits for the
first branch to be completed.
A branch(LK = 1) followed by a branch(LK = 1)—Fetching is stopped, and the
second branch waits for the first branch to be completed. (Note: a
bl
instruction does
not have to wait for a branch(LK = 1) to complete.)
A
bc
(based-on-CR) waiting for resolution due to a CR-dependency followed by a
bc
(based-on-CR)—Fetching is stopped and the second branch waits for the first
CR-dependency to be resolved.
7.4.1.2
Static Branch Prediction
Static branch prediction allows software (for example, compilers) to give a hint to the
machine hardware about the direction the branch is likely to take. When a branch
instruction encounters a data dependency, the BPU waits for the required condition code to
become available. Rather than stalling instruction dispatch until the source operand is
ready, the G2 core predicts the likely path and instructions are fetched and executed along
that path. When the branch operand becomes available, the branch is evaluated. If the
prediction is correct, program flow continues along that path uninterrupted; otherwise, the
processor backs up and program flow resumes along the correct path.
If the target address of the branch (link or count register) is modified by an instruction that
appears before the branch instruction, the BPU waits until the target address is available.
The G2 core executes through one level of prediction. The processor may not predict a
branch if a prior branch instruction is still unresolved.
The number of instructions that can be executed after branch prediction is limited by the
fact that instructions in the predicted stream cannot update the register files or memory until
the branch is resolved. That is, instructions may be dispatched and executed, but cannot
reach the write-back stage in the completion unit, instead, it stalls in the completion queue.
When CQ is full, no more instructions can be dispatched.
In the case of a misprediction, the G2 core is able to redirect the machine state rather
effortlessly because the programing model has not been updated. When a branch is found
to be mispredicted, all instructions that were dispatched subsequent to the predicted branch
instruction are simply flushed from the completion queue, and their results flushed from the
rename registers. No architected register state needs to be restored because no architected
register state was modified by the instructions following the unresolved predicted branch.
F
Freescale Semiconductor, Inc.
n
.