public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Auto-vectorization of if-conversion
@ 2009-12-07 11:20 Fahimeh Yazdanpanah
  2009-12-07 13:32 ` Ira Rosen
  0 siblings, 1 reply; 4+ messages in thread
From: Fahimeh Yazdanpanah @ 2009-12-07 11:20 UTC (permalink / raw)
  To: Ira Rosen; +Cc: gcc-help

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@il.ibm.com> wrote:


From: Ira Rosen <IRAR@il.ibm.com>
Subject: Re: Auto-vectorization of if-conversion
To: "Fahimeh Yazdanpanah" <fahim_yazdan@yahoo.com>
Cc: gcc-help@gcc.gnu.org
Date: Sunday, December 6, 2009, 7:38 AM




gcc-help-owner@gcc.gnu.org wrote on 03/12/2009 17:16:42:

> Fahimeh Yazdanpanah <fahim_yazdan@yahoo.com>
> Sent by: gcc-help-owner@gcc.gnu.org
>
> 03/12/2009 17:16
>
> To
>
> gcc-help@gcc.gnu.org
>
> 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
>
>
>
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Auto-vectorization of if-conversion
  2009-12-07 11:20 Auto-vectorization of if-conversion Fahimeh Yazdanpanah
@ 2009-12-07 13:32 ` Ira Rosen
  0 siblings, 0 replies; 4+ messages in thread
From: Ira Rosen @ 2009-12-07 13:32 UTC (permalink / raw)
  To: Fahimeh Yazdanpanah; +Cc: gcc-help



Fahimeh Yazdanpanah <fahim_yazdan@yahoo.com> wrote on 07/12/2009 13:11:20:

> Fahimeh Yazdanpanah <fahim_yazdan@yahoo.com>
> 07/12/2009 13:11
>
> To
>
> Ira Rosen/Haifa/IBM@IBMIL
>
> cc
>
> gcc-help@gcc.gnu.org
>
> Subject
>
> Re: Auto-vectorization of if-conversion
>
> 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?

It gets vectorized for me with current mainline (and also 4.3) on
x86_64-suse-linux with -O2 -ftree-vectorize.

Ira

>
> Thanks in advance,
> Best regards,
> Fahimeh
>
> --- On Sun, 12/6/09, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> From: Ira Rosen <IRAR@il.ibm.com>
> Subject: Re: Auto-vectorization of if-conversion
> To: "Fahimeh Yazdanpanah" <fahim_yazdan@yahoo.com>
> Cc: gcc-help@gcc.gnu.org
> Date: Sunday, December 6, 2009, 7:38 AM
>
>
>
>
> gcc-help-owner@gcc.gnu.org wrote on 03/12/2009 17:16:42:
>
> > Fahimeh Yazdanpanah <fahim_yazdan@yahoo.com>
> > Sent by: gcc-help-owner@gcc.gnu.org
> >
> > 03/12/2009 17:16
> >
> > To
> >
> > gcc-help@gcc.gnu.org
> >
> > 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
> >
> >
> >
> >
>
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Auto-vectorization of if-conversion
  2009-12-03 15:21 Fahimeh Yazdanpanah
@ 2009-12-06 12:15 ` Ira Rosen
  0 siblings, 0 replies; 4+ messages in thread
From: Ira Rosen @ 2009-12-06 12:15 UTC (permalink / raw)
  To: Fahimeh Yazdanpanah; +Cc: gcc-help



gcc-help-owner@gcc.gnu.org wrote on 03/12/2009 17:16:42:

> Fahimeh Yazdanpanah <fahim_yazdan@yahoo.com>
> Sent by: gcc-help-owner@gcc.gnu.org
>
> 03/12/2009 17:16
>
> To
>
> gcc-help@gcc.gnu.org
>
> 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
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Auto-vectorization of if-conversion
@ 2009-12-03 15:21 Fahimeh Yazdanpanah
  2009-12-06 12:15 ` Ira Rosen
  0 siblings, 1 reply; 4+ messages in thread
From: Fahimeh Yazdanpanah @ 2009-12-03 15:21 UTC (permalink / raw)
  To: gcc-help

Hello,

I am trying to vectorize this loop with gcc-4.4.2 under 64-bit linux ubuntu : 

 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?

Thanks in advance,
Best regards,
Fahimeh



      

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-07 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-07 11:20 Auto-vectorization of if-conversion Fahimeh Yazdanpanah
2009-12-07 13:32 ` Ira Rosen
  -- strict thread matches above, loose matches on Subject: below --
2009-12-03 15:21 Fahimeh Yazdanpanah
2009-12-06 12:15 ` Ira Rosen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).