blob: 45fff9417cf1bbd27a48abf865a1cf65ca7eb766 [file] [log] [blame] [raw]
// Compile with -O3 to see autovectorization
int testFunction(int* input, int length) {
#if __GNUC_MINOR__ >= 7
// gcc 4.7 allows us to tell it about alignments.
input = static_cast<int*>(__builtin_assume_aligned(input, 16));
#endif
int sum = 0;
for (int i = 0; i < length; ++i) {
sum += input[i];
}
return sum;
}