Jason Merrill wrote:
On 10/10/2013 04:46 AM, Tobias Burnus wrote:
I considered to add the annotation also to C++11's range-based loops,
but as those are unlikely to vectorize, I didn't do so.
I would think that a range-based loop over an array should vectorize
nicely:
int ar[8];
for (int i: ar) { ... }
They do - but during my experiments they either also did without
"#pragma GCC ivdep" – typically with static arrays like yours – or they
didn't with vector<>.
However, I came now up with an example where "#pragma GCC ivdep" should
have an effect:
int ar[100];
void foo(int *a) {
for (auto &i : ar) {
i *= *a;
}
}
Therefore, I will send a follow up patch.
Tobias