This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Any way to do branch hints?
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Joe dot Buck at synopsys dot COM (Joe Buck)
- Cc: ak at muc dot de (Andi Kleen), pinskia at physics dot uc dot edu (Andrew Pinski), jkj at sco dot com, gcc at gcc dot gnu dot org
- Date: Tue, 25 May 2004 13:16:43 -0400 (EDT)
- Subject: Re: Any way to do branch hints?
>
>
> Andrew Pinski <pinskia@physics.uc.edu> writes:
> > > __builtin_expect.
>
> On Tue, May 25, 2004 at 06:56:15PM +0200, Andi Kleen wrote:
> > Intel P4 has a new branch hint prefix for conditional jumps, but afaik
> > gcc doesn't generate it right now even with -march=pentium4 and
> > __builtin_expect. I think that is what Kean asked about.
> >
> > Of course you get some part of this from the block reordering
> > and the "if it jumps backwards it must be taken" heuristics,
> > but telling the CPU explicitely may be a stronger hint.
>
> Ah, but the conditional branch hint field just changes the default
> branch hint, right? (This is typically to assume that forward branches
> aren't taken and backward branches are). So if gcc arranges the code
> such that the __builtin_expect direction is the fall-through direction,
> then it would be no faster to use the branch hint prefix. Right?
>
> Of course, the ability to use the prefix might add more flexibility.
Of course we already add the conditional branch hint fields for pentium4,
see <http//gcc.gnu.org/ml/gcc-patches/2001-06/msg00065.html>.
Thanks,
Andrew Pinski