Any way to do branch hints?
Andrew Pinski
pinskia@physics.uc.edu
Tue May 25 17:16:00 GMT 2004
>
>
> 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
More information about the Gcc
mailing list