Actually GCC does not help reduce branch misprediction rate on modern X86 processors. Reducing branch taken rate is more important. Related discussion: https://gcc.gnu.org/ml/gcc/2014-12/msg00000.html
Yuan 2015-01-13 22:13 GMT+08:00 <paul_kon...@dell.com>: > Depending on what the processor hardware can do, the data you need is the > branch mispredict rate. A lot of processors will predict forward branches > not taken, reverse branches taken, and I believe GCC optimizes that way. > (Some processors are different: MC68040 predicts all branches taken no matter > what direction!) If the mispredict rate is unreasonably high, then that > might indeed suggest missed optimizations. > > paul