Review these guidelines, restrictions, and examples, and check them against your code to eliminate ambiguities that prevent the compiler from achieving optimal vectorization.
Use straight-line code (a single basic block)
Use vector data only; that is, arrays and invariant expressions on the right hand side of assignments. Array references can appear on the left hand side of assignments.
Use only assignment statements
Function calls
Unvectorizable operations
Mixing vectorizable types in the same loop
Data-dependent loop exit conditions
To make your code vectorizable, you will often need to make some changes to your loops. However, you should make only the changes needed to enable vectorization and no others. In particular, you should avoid these common changes:
Do not unroll your loops, the compiler does this automatically.
Do not decompose one loop with several statements in the body into several single-statement loops.