Lukas' Notes

branch-prediction

Definition

Static Branch Prediction

Static branch prediction is a branch prediction strategy in which the prediction is fixed and does not depend on the execution history of the branch.

Schemes

Always not taken

Definition

Always Not Taken Branch Prediction

Always not taken is a static branch prediction strategy that always predicts a branch is not taken, so execution continues with the next sequential instruction.

This is sometimes called fall-through prediction, because the processor stays on the path .

Link to original

Always taken

Definition

Always Taken Branch Prediction

Always taken is a static branch prediction strategy that always predicts a branch is taken, so execution jumps to the branch target.

Link to original

Backwards taken, forwards not taken

Definition

Backwards Taken Forwards Not Taken Branch Prediction

Backwards taken, forwards not taken (BTFNT) is a static branch prediction heuristic that predicts a branch based on the sign of its offset.

  • If the branch target lies behind the current PC (negative offset), the branch is predicted taken — these are typically loop back-edges.
  • If the target lies ahead (positive offset), the branch is predicted not taken — these are typically forward branches in if–else constructs where the fall-through path is common.

BTFNT uses no runtime history and requires no storage. The prediction is determined entirely by the branch offset encoded in the instruction.

Link to original