On 2015-07-02 17:13, Bob Rutledge wrote:
>
> The fastest branch is the one not taken.
>
Hmmm... Not necessarily. It's been discussed among these pages
that the zSeries branch prediction logic assumes for most branches
that the branch will less often be taken, and optimizes for the
"not taken" case. Except that for BCT(R) it optimizes for the
"branch taken" case. The branch taken should be faster.
I would hope that it also optimizes unconditional branches for
the "branch taken" case. If so, would a programmer who knows
a priori that a particular branch is more likely to be taken
do better to replace:
BC MASK,LABEL
with:
BC 15-MASK,*+8 * Branch usually not taken; fall through
BC 15,LABEL
This sort of ad hoc optimization is likely to be Overcome by Events
with any new hardware release, and should be left to compiler authors.
-- gil