0

I found:

(Sandy Bridge)

Pattern recognition for indirect jumps and calls

Indirect jumps and indirect calls (but not returns) are predicted using the same two-level predictor as branch instructions.

here on page 27:

http://www.agner.org/optimize/microarchitecture.pdf

I do not understand how conditional and unconditional branches can both use a 2-bit predictor? I thought unconditional branches would use a Branch Target Buffer (BTB). How can unconditional branches be predicted using a 2-bit predictor?!

Could somebody please explain, say for a recent Intel CPU, how the branch prediction works for conditional and unconditional branches with regards to predictors, history tables and BTB caches? I am uncertain if they work together, for both types of branches, or they both exist but only handle different branch types??

intrigued_66
  • 16,082
  • 51
  • 118
  • 189
  • http://www.anandtech.com/show/3922/intels-sandy-bridge-architecture-exposed/2 . Also - 2-level != 2-bit, and uncoditional != indirect – Leeor Jan 19 '15 at 19:22
  • @Leeor Sorry, I meant conditional and indirect. Regarding the link you sent me, how do the BTB and BHT interact together? I thought BTB is used immediately to determine whether the instruction is a branch/return the branch address and then the BHT is used to decide whether to actually branch there, or next fetch PC+4? Your link seems to suggest instructions are split in to conditional/indirect, conditional use the BHT and indirect use the BTB? – intrigued_66 Jan 20 '15 at 20:46
  • You actually have all 4 combinations of {direct,indirect} x {conditional, unconditional}, indirect ones need a target prediction, conditional ones need an outcome prediction, and a combination of those require both predictions. There's some more about this in this question - http://stackoverflow.com/questions/21787457/branch-target-prediction-in-conjunction-with-branch-prediction – Leeor Jan 20 '15 at 22:04

0 Answers0