Hello,
icc 17 does not vectorize the following simple code:
int main(int argc, char const *argv[])
{
#define SIZE 1024*1024*1024ULL
unsigned long i;
float *A,*B,*C;
A = malloc(sizeof(float) * SIZE);
B = malloc(sizeof(float) * SIZE);
C = malloc(sizeof(float) * SIZE);
for (i=0; i<SIZE; i++)
C[i] = A[i] + B[i];
printf("done %ld %f\n", SIZE, C[i]);
return 0;
}
The vectorization report states:
LOOP BEGIN at main.c(12,5) remark #15523: loop was not vectorized: loop control variable i was found, but loop iteration count cannot be computed before executing the loop remark #25478: While Loop Unrolled by 2 LOOP END
, which does not make sense and looks like a bug. Reducing the SIZE value slightly (e.g., to 2^31-1), or removing the U from the integer qualifier at the end of the define (i.e., from ULL to LL) are workarounds.
Is this a known problem in icc? Are there any better workarounds?
Best regards,