▲ | dmoy 2 days ago | |
There's a bunch of ways it works. There's a tradeoff between hardware cost and accuracy. Sometimes it's static, sometimes there's a counter of varying size (1 bit, 2 bit, etc). It can get a lot more complicated. The basic branch predictors are very cheap, and often good enough (90%+ accuracy). Patterson & Hennessy goes into a bunch of detail. |