13.07.2015 Views

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

Intel® 64 and IA-32 Architectures Optimization Reference Manual

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GENERAL OPTIMIZATION GUIDELINESPentium M, Intel Core Solo <strong>and</strong> Intel Core Duo processors have similar static predictionalgorithms that:• predict unconditional branches to be taken• predict indirect branches to be NOT takenIn addition, conditional branches in processors based on the Intel NetBurst microarchitectureare predicted using the following static prediction algorithm:• predict backward conditional branches to be taken; rule is suitable for loops• predict forward conditional branches to be NOT takenPentium M, Intel Core Solo <strong>and</strong> Intel Core Duo processors do not statically predictconditional branches according to the jump direction. All conditional branches aredynamically predicted, even at first appearance.The following rule applies to static elimination.Assembly/Compiler Coding Rule 3. (M impact, H generality) Arrange code tobe consistent with the static branch prediction algorithm: make the fall-throughcode following a conditional branch be the likely target for a branch with a forwardtarget, <strong>and</strong> make the fall-through code following a conditional branch be theunlikely target for a branch with a backward target.Example 3-5 illustrates the static branch prediction algorithm. The body of an IF-THEN conditional is predicted.Example 3-5. Pentium 4 Processor Static Branch Prediction Algorithm//Forward condition branches not taken (fall through)IF {....↓}IF {...↓}//Backward conditional branches are takenLOOP {...↑ −− }//Unconditional branches takenJMP------→Examples 3-6 <strong>and</strong> Example 3-7 provide basic rules for a static prediction algorithm.In Example 3-6, the backward branch (JC BEGIN) is not in the BTB the first time3-10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!