3 ms·
How would "conditional call" differ from the obvious pattern of forward branching on the negative of the original condition to skip over a call instruction? The
by zozbot234 5y ago
How would "conditional call" differ from the obvious pattern of forward branching on the negative of the original condition to skip over a call instruction? The pattern could easily be macro-fused in hardware if deemed worthwhile.
- titzer 5y agoThe default prediction for unseen branches is not taken, so the processor would default to speculatively falling through and off into the call.
- zozbot234 5y ago"Default" (static) prediction matters very little in modern processors though. Branch prediction is largely based on dynamic data about the actual program run.
- titzer 5y agoThey still do matter because programs are huge, with lots of cold and warm (not hot) code, and there are only so many branch prediction entries. Compilers have been tuned for several decades with this assumption in mind and processors, in turn, keep reinforcing it, because they keep running code produced by such compilers. It'll take some very extensive measurements to show that it is no longer the case.
- zozbot234 5y agoThe fact that modern CPU architectures in general have abandoned custom prediction hints suggests that static branch prediction is being viewed as less important.
- titzer 5y agoSure, but default "predict not-taken" is a very decent zero-cost heuristic that hardware will probably keep using for the foreseeable future.