Any way to do branch hints?
Andrew Pinski
pinskia@physics.uc.edu
Tue May 25 16:42:00 GMT 2004
Yes,
__builtin_expect.
Thanks,
Andrew Pinski
>
> Hi everyone,
>
> Does gcc have any way in which I can portably introduce
> branch hints, and do any of the machine descriptions
> (of most personal interest is i386.md) use them? What
> I'd liket o be able to do is something like:
>
> int myfunc (void)
> {
> int x = foo();
>
> if (x == 0) __attribute__(branch-hint-not-taken)
> error();
> else {
> do_some_work();
> }
> return x;
> }
>
> Armed with such information it would be great if the
> code generated for a conditional jump would actually
> include the hint prefix to the insn. I couldn't find
> anything in the 3.4 docs, so I am guessing it doesn't
> exist, but I may just have grepped for the wrong
> things.
>
> Kean
>
>
More information about the Gcc
mailing list