This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Any way to do branch hints?

> Andrew Pinski <> 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//>.

Andrew Pinski

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]