On 29 April 2016 at 12:59, Jim Mulder <[email protected]> wrote: > The relevant comparison is not conditional branch vs. > unconditional branch. It is branch not taken vs. branch taken. > Sequential execution is always best. Branch prediction tries to > mitigate some of the effects of nonsequential execution.
Right. And presumably even an "unconditional" branch that is actually a branch on condition with a CC mask of 15 can be mispredicted, in theory. And therefore the instruction fetch stream at the address following the branch will keep on fetching, even though it fully expects to switch to the new stream at the branch target address. And then that first stream will have to be thrown away, which presumably isn't free. In the tiny example case, the stream after the branch is not only a valid instruction (which it might or might not be in the case of branching over an eyecatcher), but it's another branch, which presumably gets predicted in its own right, even though it's at the same address as the first branch's target. Now what about a truly unconditional branch, i.e. one that doesn't depend on the condition code? Would BRAS perform better in this regard than even J, or is the cost of saving stuff in r1 very high? Surely there is no reason to continue fetching after such an instruction. It can't not branch, and it can't program check. Tony H. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
