Re: Branch prediction hints in an ISA

Dietrich Epp <dietrich@216.26.55.26>
19 Oct 2000 14:28:05 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: Branch prediction hints in an ISA Kahrs.Juergen@stn-atlas.de (Juergen Kahrs) (2000-10-12)
Re: Branch prediction hints in an ISA erik@arbat.com (Erik Corry) (2000-10-12)
Re: Branch prediction hints in an ISA vbdis@aol.com (2000-10-12)
Re: Branch prediction hints in an ISA zs@ender.cs.mu.oz.au (2000-10-15)
Re: Branch prediction hints in an ISA david.thompson1@worldnet.att.net (David Thompson) (2000-10-18)
Re: Branch prediction hints in an ISA anton@mips.complang.tuwien.ac.at (2000-10-18)
Re: Branch prediction hints in an ISA dietrich@216.26.55.26 (Dietrich Epp) (2000-10-19)
Re: Branch prediction hints in an ISA torbenm@diku.dk (2000-10-19)
| List of all articles for this month |
From: Dietrich Epp <dietrich@216.26.55.26>
Newsgroups: comp.compilers
Date: 19 Oct 2000 14:28:05 -0400
Organization: Compilers Central
References: 00-10-078 00-10-092 00-10-106
Keywords: optimize, linker

On 15 Oct 2000, Zoltan Somogyi wrote:


> Erik Corry <erik@arbat.com> writes:
> >But according to the Alpha optimisation guide, if you know
> >which way a branch is likely to go it is almost always worth
> >moving the less taken branch to somewhere completely different.
> >This reduces the working set. If you move it to the end of
> >the function then it will be a forward branch, and so will be
> >predicted not taken.
>
> Absolutely; with most modern machines, one wants to minimize the
> number of taken branches, whether the branch is predicted or not.
>
> However, there are occasions where you cannot follow this piece of
> advice. One such sitation is where a basic block ends with a
> conditional branch to its own start; putting a basic block *after*
> itself is pretty tough :-) Therefore having a mechanism that tells the
> branch predictor that a branch should be predicted to be taken is
> still useful.


For the PowerPC chip, branch instructions include a bit which tells
the processor which way to predict the branch. To make a long story
short, correctly predicted branches incur a performance hit so small
it usually doesn't affect thoroughput. This way the compiler (or
assembly programmer) can use their ingenuity to determine the correct
prediction.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.