High. E.g. gcc 4.8.2 vectorizes this on my machine (-march=native -mtune=native -O3 -ffast-math -ftree-vectorizer-verbose=1):
for (size_t i = 0; i < n; ++i) { sum += a[i]; sum += b[i]; }
But doesn't vectorize:
for (double *p = a; p < a + n; ++p) { sum += *p; sum += *(b + (p-a)); }
tl;dr: your compiler writer probably knows better than you.
High. E.g. gcc 4.8.2 vectorizes this on my machine (-march=native -mtune=native -O3 -ffast-math -ftree-vectorizer-verbose=1):
(a and b have the same length)But doesn't vectorize:
(Yes, you can make an extra pointer for b, but just for the sake of the example.)tl;dr: your compiler writer probably knows better than you.