https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85740
--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Richard Biener from comment #7) > Confirmed with a Haswell CPU as well. Without the __builtin_expect we > rightfully predict the branch to be 50%/50% which means BB re-ordering will > do either nothing to pre-existing order or apply some other magic. CFG > construction makes the > flow exactly as visible in the source. > > So not sure what you are asking here, but annotating the libgfortran routines > or inline expansion from the FE with __builtin_expect is probably a good > idea. If the code is emitted in Fortran FE, that it's similar to specific predictors: grep for 'PRED_FORTRAN_'. These are predictors emitted by the FE and can have specific probability based on SPEC benchmarks. Can you Thomas point me to code that emits the maxloc/minloc? > > At least I can't really see how to easily derive a new predictor that would > match > this case... Agree.