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++;
}
}
