This is the mail archive of the gcc@gcc.gnu.org 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?



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
> 
> 


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