Re: Auto-vectorization of if-conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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
>
>
>
>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux