3 ms·
Intel's Itanium line had the following hardware support for loops: * Register rotation [1]: referenced registers inside the loop are cycled on each iteration
by rzzzt 12y ago
Intel's Itanium line had the following hardware support for loops:
* Register rotation [1]: referenced registers inside the loop are cycled on each iteration
* Branch prediction [2]: with a dedicated loop count register, the CPU can tell with complete certainty when not to take the jump to the beginning (no mispredictions at the exit)
[1] http://www.cs.nmsu.edu/~rvinyard/itanium/register_rotation.htm http://www.cs.nmsu.edu/~rvinyard/itanium/register_rotation.h...
[2] http://www.cs.nmsu.edu/~rvinyard/itanium/branching.htm http://www.cs.nmsu.edu/~rvinyard/itanium/branching.htm
- petjuh 12y agoBranch prediction is already extremely efficient for loops, it simply assumes the last comparison will be the same. For loops this is true for all but the first and last iteration.
- SamReidHughes 12y agoEven if it's perfect it still takes up branch prediction overhead in the processor, and hurts the performance of other branches. Also, getting the first or last iteration wrong is pretty bad for a ton of for loops out there.