| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Optimisation |
MB> > MB> > > From a machine level point of view, you want branches to be not taken > > more frequently than taken. This is because taking a branch > > always flushes the prefetch instruction queue in the Intel > > processors, [...] > MB> > > JdeBP> With speculative execution and branch prediction in > JdeBP> processors like the Pentium Pro, or the Cyrix 5x86 and 6x86, > JdeBP> I don't believe that this is as true as it used to be. > > The Cyrix 5x86 does not do any speculative execution [...] MB> The Cyrix 6x86 does both. The Cyrix 5x86 does branch prediction. Which is what I implied. MB> > In all cases, a branch taken flushes the pipeline. MB> No. It obviously doesn't flush the pipeline if it contains the instructions for the target of the branch. That is, after all, what branch prediction is all about. The Cyrix branch prediction logic uses a heuristic to guess whether to fill the pre-fetch queue with instructions from the straight-line execution path or from the branch target. It can get it wrong either way. It can pre-fetch from the branch target, and the branch ends up not being taken, or it can pre-fetch from the straight-line path, and the branch ends up being taken. In either event, a wrong guess results in a queue flush, and a correct guess does not. So it's not the case that "branch not taken" will never result in a pipeline flush and "branch taken" will always do so. That's the simple world of the Pentium and 486. In the more complex world of the Cyrix 5x86/6x86 and Pentium Pro, it is the case that the most efficient arrangement is to code so that the most commonly taken path matches the guess that the branch prediction heuristic will make. With all of these complexities in the new CPU architectures it is, IMO, getting to the stage where hand-optimised assembly language code is exceedingly unlikely to be as efficient as machine-optimised code, simply because a human won't be aware of the issues involved, or won't be able to manually and reliably perform the steps necessary to determine the optimal code sequences. > JdeBP < ___ X MegaMail 2.10 #0: --- Maximus/2 3.01* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4) SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407 SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1 @PATH: 440/4 141/209 270/101 712/624 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.