https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61938
--- Comment #3 from harmeeksingh at gmail dot com ---
#include <stdio.h>
#define VEC 1024
typedef long int int64;
typedef int int32;
void foo (int arraysize,
int *__restrict result,
int *__restrict selectvector,
int selectelements,
int64 *__restrict array,
int64 compval)
{
int k, i;
for (k =0,i=0; i < arraysize; ++i) {
result[k] = i; k += (array[i] == compval);
}
}
main()
{
int result[VEC];
int selectvector[VEC];
int selectelements;
int64 array[VEC];
int k, i;
foo(VEC, result, selectvector, VEC, array, 1);
}
Even the above does not vectorize
gcc -fPIC -shared -DCLS=64 -ffast-math -mfpmath=sse -mmmx -msse -msse2
-ftree-vectorize -ftree-vectorizer-verbose=7 -O3 -march=native /tmp/x.c -o
/tmp/x
Analyzing loop at /tmp/x.c:17
17: not vectorized: data ref analysis failed *D.2502_9 = i_27;
/tmp/x.c:9: note: vectorized 0 loops in function.