This topic addresses specific language features that better help to vectorize code.
The __declspec(align(n)) declaration enables you to overcome hardware alignment constraints. The restrict qualifier and the pragmas address the stylistic issues due to lexical scope, data dependency, and ambiguity resolution.
Feature |
Description |
---|---|
__declspec(align(n)) |
Directs the compiler to align the variable to an n-byte boundary. Address of the variable is address mod n=0. |
__declspec(align(n,off)) |
Directs the compiler to align the variable to an n-byte boundary with offset off within each n-byte boundary. Address of the variable is address mod n=off. |
restrict |
Permits the disambiguator flexibility in alias assumptions, which enables more vectorization. |
__assume_aligned(a,n) |
Instructs the compiler to assume that array a is aligned on an n-byte boundary; used in cases where the compiler has failed to obtain alignment information. |
#pragma ivdep |
Instructs the compiler to ignore assumed vector dependencies. |
#pragma vector |
Specifies how to vectorize the loop and indicates that efficiency heuristics should be ignored. |
#pragma novector |
Specifies that the loop should never be vectorized, |
See Vectorization Support for more information on using the pragmas.