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: jkj at sco dot com (Kean Johnston)
- Cc: gcc at gcc dot gnu dot org (GCC development group)
- Date: Tue, 25 May 2004 12:42:14 -0400 (EDT)
- Subject: Re: Any way to do branch hints?
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
>
>