This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: branch predictions
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: branch predictions
- From: Andi Kleen <ak at suse dot de>
- Date: 04 May 2000 12:24:34 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <28317.957431489@upchuck>
Jeffrey A Law <law@cygnus.com> writes:
> I can think of three heuristics which would work to resolve this problem.
>
> 1. Given two successors, if one unconditionally exits and the
> other does not, then predict the path which does not unconditionally
> exit.
>
> 2. Given two successors, if one passes control to a loop that it
> dominates and the other does not, then predict the path to the
> dominated loop.
>
> 3. If we do not have any kind of prediction and one of the blocks
> physically follows the current block, then predict the block which
> physically follows the current block. ie, don't rearrange code
> at random ;-)
>
> I did a very quick and dirty implementation of #1. That allowed us to
> properly predict the key branch and we got the desired code.
>
>
> Thoughts?
(1) sounds fine, but it would be nice if (3) was available as a command
line option. (2) looks a bit dubious for me.
-Andi