Branch Prediction

Creator
Created
Created
2019 Nov 5 5:17
Editor
Edited
Edited
2024 Jun 21 1:47
Refs
Refs

Halting Problem
때문에 99프로만 맞음

Forward conditional branches

Based on a run-time condition, the PC (Program Counter) is changed to point to an address forward in the instruction stream.

Backward conditional branches

The PC is changed to point backward in the instruction stream. The branch is based on some condition, such as branching backwards to the beginning of a program loop when a test at the end of the loop states the loop should be executed again.

Unconditional branches

This includes jumps, procedure calls and returns that have no specific condition. For example, an unconditional jump instruction might be coded in assembly language as simply jmp, and the instruction stream must immediately be directed to the target location pointed to by the jump instruction, whereas a conditional jump that might be coded as jmpne would redirect the instruction stream only if the result of a comparison of two values in a previous compare instructions shows the values to not be equal. (The segmented addressing scheme used by the x86 architecture adds extra complexity, since jumps can be either near (within a segment) or far (outside the segment). Each type has different effects on branch prediction algorithms.
 
 
 

Branch Prediction Unit

Typically, it’s a per-core (not shared between physical cores, but shared between virtual cores of hyper-threading) unit.
notion image
Indirect Branch Speculation Protections
 
 
 

Branch Target Buffer (BTB)

 

Return stack buffer (RSB)

Micro architectural cache component which is a component of x86.
 

Branch History Buffer

 
 
 
 

Recommendations