IT lexicon › Programming › SLP vectorization

SLP vectorization

Programming På svenska → Updated: 2026-11-06

Vectorizing straight-line code: the compiler finds similar scalar statements sitting side by side and fuses them into one SIMD instruction, no loop required.

Classic vectorization starts from a loop and spreads its iterations across vector lanes. Samuel Larsen and Saman Amarasinghe at MIT flipped the perspective in 2000 with superword level parallelism: four lines running from a[0] = b[0] + c[0] to a[3] = b[3] + c[3] are already parallel, they just happen to be written vertically. The pass builds trees of isomorphic operations over adjacent memory and swaps them for a vector operation whenever the cost model agrees.

LLVM has shipped an SLP vectorizer enabled by default since 2013, and GCC runs its own basic-block variant. It pairs naturally with loop unrolling, since an unrolled loop is exactly the kind of line-by-line code SLP feeds on. What stops it is, as ever, pointers that might alias.

← Back to the lexicon