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: Branch prediction


On 05/30/2013 03:03 PM, Raphael Clifford wrote:
> Thank you for this. My question was about something more specific
> however. I am interested specifically in branch prediction.  For
> example one could add  __builtin_expect or the compiler can use the
> information it finds in its profiling.  How is this information used
> by gcc to provide optimised assembly (for a modern Pentium)?
> 
> One option could be to lay out more likely paths differently or even
> perhaps to reorder conditional statements where that is valid but what
> does gcc do and does it actually help?

Most commonly, moving unlikely branches to the end of a function.

Andrew.


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