Loop vectorizer now knows to vectorize GEP and create masked gather and scatter intrinsics for random memory access.
The feature is enabled on AVX-512 target.
the following loops are vectorized on AVX-512:
struct In {
float a; float b;
};
void foo1 (float * restrict in, float * restrict out, int * restrict trigger, int * restrict index) {
for (int i=0; i<SIZE; ++i) { if (trigger[i] > 0) { out[i] = in[index[i]] + (float) 0.5; } }
}
void foo2 (In * restrict in, float * restrict out, int * restrict trigger) {
for (int i=0; i<SIZE; ++i) { if (trigger[i] > 0) { out[i] = in[i].b + (float) 0.5; } }
}
struct Out {
float a; float b;
};
void foo3 (In * restrict in, Out * restrict out, int * restrict trigger) {
for (int i=0; i<SIZE; ++i) { if (trigger[i] > 0) { out[i].b = in[i].b + (float) 0.5; } }
}