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

           Summary: vectorization of conditional code happens only on
                    local variables
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: vincenzo.innoce...@cern.ch


in this example loop1 does not vectorize, loop2 does 
const int N=64;
float c[N];
float d[N];

void loop1() {
  for (int i=0; i!=N; ++i) {
    if (c[i]<0) d[i] = -d[i];
  }
}

void loop2() {
  for (int i=0; i!=N; ++i) {
    float tmp = d[i];
    if (c[i]<0) tmp = -tmp;
    d[i]=tmp;
  }
}

Reply via email to