This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/49773] New: use of class data members prevent vectorization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49773

           Summary: use of class data members prevent vectorization
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


in this example below the loop in the first method does not vectorize, the
second does.


struct Foo {
  float a;
  float b;

  void compute1(float * __restrict__ x, float const * __restrict__ y, int N)
const;
  void compute2(float * __restrict__ x, float const * __restrict__ y, int N)
const;

};

void Foo::compute1(float * __restrict__ x, float const * __restrict__ y, int N)
const {
  for (int i=0; i!=N; ++i)
    x[i] = a + b*y[i];
}

void Foo::compute2(float * __restrict__ x, float const * __restrict__ y, int N)
const {
  float la=a, lb=b;
  for (int i=0; i!=N; ++i)
    x[i] = la + lb*y[i];
}


test/vectClass.cpp:11: note: not vectorized: loop contains function calls or
data references that cannot be analyzed
test/vectClass.cpp:10: note: vectorized 0 loops in function.
vs

test/vectClass.cpp:17: note: Profitability threshold is 5 loop iterations.
test/vectClass.cpp:17: note: LOOP VECTORIZED.
test/vectClass.cpp:15: note: vectorized 1 loops in function.


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