This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Any way to do branch hints?
> Andrew Pinski <pinskia@physics.uc.edu> writes:
>
> > Yes,
> >
> > __builtin_expect.
>
> 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.
GCC should generate these on __builtin_expect and friends even on
-mcpu=pentium4, but we usually manage to redirect things in a way so the
prefixes are not needed.
Honza
>
> 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.
>
> -Andi