This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

maybe vectorizer-bug regarding unhandled data-ref


Hi,

while playing with gcc-4.3 rev. 121994, i encountered a problem with autovectorisation.

In the following simple code, the inner loop of c1() becomes vectorized as expected, but the inner loop of c2() not because of

  test2.c:15: note: ===== analyze_loop_nest =====
  test2.c:15: note: === vect_analyze_loop_form ===
  test2.c:15: note: === get_loop_niters ===
  test2.c:15: note: ==> get_loop_niters:(unsigned int) n_6(D)
  test2.c:15: note: Symbolic number of iterations is (unsigned int) n_6(D)
  test2.c:15: note: === vect_analyze_data_refs ===

  test2.c:15: note: get vectype with 4 units of type float
  test2.c:15: note: vectype: vector float
  test2.c:15: note: not vectorized: unhandled data-ref
  test2.c:15: note: bad data references.

(even with -ftree-vectorizer-verbose=99 there is no more info than that)

The only difference between the two functions is that in c1() static arrays are used and in c2() pointer to arrays.. Is this a problem with aliasing/alignment of pointer parameters or a vectorizer bug? And is there a work-around?

Best regards,
Thomas

--

float a[256],b[16],o[271];

void c1()
{
  for(int i=0;i<256;i++) {
    for(int j=0;j<16;j++) {
      o[i+j]+=a[i]*b[j];
    }
  }
}

void c2(int m, int n, float *a, float *b, float *o)
{
  for(int i=0;i<m;i++) {
    for(int j=0;j<n;j++) {
      o[i+j]+=a[i]*b[j];
    }
  }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]