CPU - Branch

Cpu Moore Law Transistor

About

  • forward branches (used to implement conditional operations like if statements)
  • backward branches (used to implement loops).

Branches may be:

  • unconditional (always taken),
  • or conditional (taken or not, depending on a computed value).

To avoid a stall, the processor must guess which instruction to fetch next:

  • the next one in memory order (corresponding to an untaken branch),
  • or the one at the branch target (corresponding to a taken branch).

Prediction

A branch predictor helps the processor make an intelligent guess about whether a branch will be taken or not. It does this by gathering statistics about how often particular branches have been taken in the past.

The performance of an if-statement depends on whether its condition has a predictable pattern. branch prediction fail

Documentation / Reference





Discover More
Card Puncher Data Processing
CPU - Condition Instruction

conditional statement in Instruction. Jcc (jump on condition code cc), SETcc (byte set on condition code cc), LOOPcc, CMOVcc (conditional move) The condition instructions use one or...
Card Puncher Data Processing
Language - Control Flow Statement (If, Switch, For) - Conditional Operators - Execution order - Branch Conditionals (aka decisions)

conditional are expressions that: determines the next statement to execute by evaluating a comparison expression Ultimately, they are predicate that returns a boolean. They model a flow of statements....
Status Flag Register
Register - Status Flag

The status flags (bits 0, 2, 4, 6, 7, and 11) of the EFLAGS register indicate the results of arithmetic instructions. The status flags allow a single arithmetic instructions to produce results...



Share this page:
Follow us:
Task Runner