When, if ever, is loop unrolling still useful?

Loop unrolling makes sense if you can break dependency chains. This gives a out of order or super-scalar CPU the possibility to schedule things better and thus run faster. A simple example: for (int i=0; i<n; i++) { sum += data[i]; } Here the dependency chain of the arguments is very short. If you get … Read more

tech