On 12/6/18 9:23 AM, Bernhard Reutner-Fischer wrote: > On 30 November 2018 10:47:45 CET, "Martin Liška" <mli...@suse.cz> wrote: >> Hi. >> >> This patch is a reaction to Jason's commit where he introduced new C++ >> attributes. >> First I would like to align cold/hot to __builtin_expect, so I adjusted >> probability >> and made the predictors first match predictors. >> >> Second I fixed how we consider the predictors in switch statements, so >> that >> we can correctly predict situation in predict-3. >> >> Honza is fine with the patch, I'll install it later if there are no >> objections. >> Survives tests and bootstrap on xc86_64-linux-gnu. > > I don't have the sources at hand but in: > > +/* Branches to hot labels are likely. */ > +DEF_PREDICTOR (PRED_HOT_LABEL, "hot label", HITRATE (90), > + PRED_FLAG_FIRST_MATCH) > + > +/* Branches to cold labels are extremely unlikely. */ > +DEF_PREDICTOR (PRED_COLD_LABEL, "cold label", HITRATE (90), > + PRED_FLAG_FIRST_MATCH) > + > > I would have expected cold labels to have a rather low hitrate, like maybe 2 > or 7, not 90 ?
No, it's fine, as we combine that with (from predict.h): enum prediction { NOT_TAKEN, TAKEN }; So it will get 10%. Martin > > Thanks, >