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.