|
|
|
|
|
|
|
where Pbreak-even is the probability indicating that it does not matter whether or not the branch is taken. The penalty in either case would be identical. |
|
|
|
|
|
|
|
|
ob:is the cycle penalty for the specified case of predicted and actual branch directions, with t being the taken direction and i being the in-line direction. This then simplifies to the equation: |
|
|
|
|
|
|
|
|
When Pactual (the probability that the branch is actually taken) is less than or equal to the calculatedPbreak-even, then the appropriate path to guess is in-line, and when it is greater, then the appropriate path is target. This does not consider the case where there are hints in the branch instructions that can be used to assist the choice of branch paths.3 Using this equation, we can calculate the break-even point for the reduced-scale processor as follows: |
|
|
|
|
|
|
|
|
This is undefined, and it is easy to see that since the branch condition is always known before the next instruction enters execution, any choice is the same here. For the super-pipelined processor, however, we get the following: |
|
|
|
|
|
|
|
|
Here it is clear that there can never be a probability P such that it is better to choose the target path; even if all branches are predicted to go to target, this is only the break-even point, and there is no loss when guessing in-line!4 |
|
|
|
|
|
|
|
|
This argument ignores the additional bus traffic5 due to continuing to fetch the in-line casenot a problem in the Baseline-series workstations, but a potential problem in any design that has several devices contending for the bus (as in a common-bus, shared-memory multiprocessor system). One solution for these designs would be to continue fetching the in-line path until there is a memory system faulteither a cache or TLB miss or protection violationand then to stall the pipeline. This solution is a typical one for |
|
|
|
 |
|
 |
|
|
3Although in these cases there is nothing to be gained by this knowledge, since guessing in-line is never worse than guessing target. |
|
|
|
 |
|
 |
|
|
4This is only the case because all branches are going to target anyway, and thus there is no difference between the penalties for guess in-line and go to target, and guess target and go to target. When there is even one single not-taken branch, then it is better to guess in-line and save the 1-cycle penalty in this one case. |
|
|
|
 |
|
 |
|
|
5The bus traffic is considered in Chapter 9. |
|
|
|
|
|