Auto-vectorization in C++ compilers

“Premature optimization is the root of all evils”… unless the compiler does it for you.

Auto-vectorization is the next best thing to auto-parallelization: the compiler statically analyses the code and speeds up tight loops by spreading the iterated values across as many available registers as possible, resulting in speed-ups that could go as high as a factor of four. If the CPU has the required instruction set, of course.

If you’re curious about how this can benefit your code (and without requiring anything at all on your part!), watch this nice video interview in MSDN Channel 9: VC11 Auto-Vectorizer.