Hello Ira, Thank you for your attention. But in the loop you modified, there was an other problem to prevent vectorization : unhandeled data refrences for bb and cc. (The compiler can not access to bb and cc for several items at the same times). Would you please guide me to solve this? Thanks in advance, Best regards, Fahimeh --- On Sun, 12/6/09, Ira Rosen <IRAR@xxxxxxxxxx> wrote: From: Ira Rosen <IRAR@xxxxxxxxxx> Subject: Re: Auto-vectorization of if-conversion To: "Fahimeh Yazdanpanah" <fahim_yazdan@xxxxxxxxx> Cc: gcc-help@xxxxxxxxxxx Date: Sunday, December 6, 2009, 7:38 AM gcc-help-owner@xxxxxxxxxxx wrote on 03/12/2009 17:16:42: > Fahimeh Yazdanpanah <fahim_yazdan@xxxxxxxxx> > Sent by: gcc-help-owner@xxxxxxxxxxx > > 03/12/2009 17:16 > > To > > gcc-help@xxxxxxxxxxx > > cc > > Subject > > Auto-vectorization of if-conversion > > Hello, > > I am trying to vectorize this loop with gcc-4.4.2 under 64-bit linuxubuntu : > > for (i = 0; i < 1024; i++) > d[i] = (a[i] > 0 ? b[i] : c[i]); > > but it is not vectorized. For compiling that, I use these flags: > gcc -O3 -fprefetch-loop-arrays -lstdc++ -ftree-vectorize -ftree- > vectorizer-verbose=2 -ffast-math -mfpmath=sse -march=core2 > > according to http://gcc.gnu.org/projects/tree-ssa/vectorization.html > , it must be vectorized. Would you please tell me what I do wrong? The if-conversion pass fails here because of speculative loads of b and c. Taking the loads outside of condition allows if-conversion and makes the loop vectorizable: for (i = 0; i < 1024; i++) { bb = b[i]; cc = c[i]; d[i] = (a[i] > 0 ? bb : cc); } Ira > > Thanks in advance, > Best regards, > Fahimeh > > > >