Cilk array notation prevents gcc auto-vectorization?

Cilk array notation prevents gcc auto-vectorization?

Hi all,

I am having a problem getting Cilk array notation to play well with Gcc auto-vectorization (i.e., -ftree-vectorize).  For example,

(Let's refer to the code snippet at as copy.c).

If I run

> gcc -fcilkplus -lcilkrts -Wall -O3 copy.c

using "gcc version 4.8.1 20130520 (prerelease) (GCC)" downloaded from, I get a functionally correct code, but only the reference loop (i.e.,

for (int i = 0; i < array_size; i++) c[i] = a[i] + b[i];


will vectorize (according to both -ftree-vectorizer-verbose=1 and manual assembly inspection).  I am having similar luck when explicitely using -ftree-vectorize without -O3.  I have verified that -O3 is not pruning the loops and the problem is still the same with other vector operators.

The simplest problem is of course a missing flag, but I don't see documentation for such a flag (beyond -fcilkplus which is needed for array notation to compile).  Further, it seems that the simplest loops described in array notation do vectorize; e.g., 'c[:] = 5;'

Thanks for any tips! 

Chris Fletcher

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.