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/61938] Vectorization not happening .


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61938

--- Comment #6 from harmeeksingh at gmail dot com ---

Equivalent code when written by hand where tmp is a intermediate array . The
compiler 
vectorizes both loops. 

  int k, i;
  /* vectorize the compares */
  for (i=0; i < arraysize; ++i) {
       tmp[i] = (array[i] == compval);
  }

  /* another loop now set the result array */
  for (k=0, i=0; i < arraysize; ++i) {
     if (tmp[i])
     {
       result[k] = i;
       k++;
     }
  }


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