[RFC PATCH] Gather vectorization (PR tree-optimization/50789)

Kirill Yukhin kirill.yukhin@gmail.com
Fri Oct 28 10:54:00 GMT 2011


Hi Jacob,
this looks really cool. I have a liitle question, since I do not
understand vectorizer as good.

Say, we have a snippet:
int *p;
int idx[N];
int arr[M];
for (...)
{
  p[i%4] += arr[idx[I]];
}
As far as I understand, we cannot do gather we, since p may point to
somewere in arr,
and, idx may took it twice.
E.g. lets take
  idx = {0, 1, 1, 2, 3, 4, 5, 6}
  arr = {0, 1, 0, 0, 0, 0, 0, 0}
  p = arr;
Correct case will have, we'll have something like arr = {0, 2, 2, 0,...}
If we'll have gather, arr may look like                    arr = {0,
2, 1, 0, ...}

So my question, does your patch catch such a cases?

Thanks, K



More information about the Gcc-patches mailing list