I want to turn off auto-vectorization for specific loops in a function. How can I do this with GCC? I know I can turn auto-vectorization off for the whole function with __attribute__((optimize("no-tree-vectorize")))
but how do I do this for individual loops in a function (with MSVC I can use add #pragma loop(no_vector)
).
void dot_int(int * __restrict a, int * __restrict b, int * __restrict c) {
for(int i=0; i<1024; i++) {
c[i] = a[i] + b[i];
}
//#pragma loop(no_vector) //don't vectorize this loop
for(int i=0; i<1024; i++) {
c[i] = a[i] + b[i];
}
}