6 ms·
Aside from other comments about weaknesses of delay slots, modern processors already do this automatically in the form of out of order execution. A branch can b
by ericpauley 7y ago
Aside from other comments about weaknesses of delay slots, modern processors already do this automatically in the form of out of order execution. A branch can be moved up and assigned priority to an execution unit if it doesn't depend on some of the previous instructions. These instructions can be queued or assigned to other execution units.
- dooglius 7y agoIt looks as though you're being downvoted but I'm not sure why. This matches my mental model of OoO execution, for instance if you have a loop like: sub eax, 1 (several non-flags-touching instructions) jmpne loop_start I would expect that a branch predictor wouldn't be needed as the jump only needs the flags register to figure out where the branch is going to go.
- gpderetta 7y agothat's not how ooo cpu work in practice. Jumps are resolved at the fetch stage, always by consulting the predictor; at this stage there is no opportunity to actually execute the jmpne instruction and check if the sign flag is set or not. When the jumpne is executed later in the pipeline, its only effect it to either commit or rollback the speculation. This is not specific of OoO cpus. In order cpus work the same way, assuming they have a predictor of course. edit: to be more precise, jumps are not not resolved at the fetch stage, but in one of the early stages, in fact there is often a bubble for taken branches as the fetcher will fetch the next instruction in the stream by default.