Autovectorization help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to use the autovectorizer in gcc 4.7.2. However I'm getting
bad data references in the .vect comments generated using
-ftree-vectorizer-verbose=, even though I have used restrict on all
arrays. Its a reference with two arrays where one array is used to
index the other: array1[array2[index]]. I don't see how this should
not be vectorizable as we only read from the arrays.

Is this not supported or is there some clever way to rewrite this?

Example:

int foo(int * restrict array1, int * restrict array2) {
  int res = 0;
  for (int i = 0; i < 50000; i++) {
    int v = array2[array1[i]]; //This gives bad data reference comment
in .vect file.
    res += v * v;
  }
  return res;
}

Thanks a lot,
Nicklas


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux