This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Loop-aware SLP


Paolo Bonzini <paolo.bonzini@gmail.com> wrote on 14/08/2007 19:07:00:

> >> struct col *a, *b;
> >> for (...)
> >>    {
> >>      a[i].r = b[i].r;
> >>      a[i].g = b[i].g;
> >>      a[i].b = b[i].b;
> >>      a[i].a = b[i].a;
> >>    }
> >
> > It is supported.
> >
> >> or even with the last assignment's RHS being 255?
> >
> > This one is not, since in this case RHSs are not isomorphic.
>
> I see.  However, it can be transformed to "a[i] = b[i] | {0,0,0,255}"
> which can also be generic-vectorized.  Do you think it would be hard to
> add this kind of transformation?
>
> Similar code would be generating "a[i] = b[i] & {255,255,255,0)".
>
> Of course, the definitive one would be to turn
>
>        a[i].r = b[i].r + (c[i].r - b[i].r) * c[i].a;
>        a[i].g = b[i].g + (c[i].g - b[i].g) * c[i].a;
>        a[i].b = b[i].b + (c[i].b - b[i].b) * c[i].a;
>        a[i].a = 0;
>
> into
>
>        a[i] = (b[i] + (c[i] - b[i]) * splat(c[i].a)) & (255,255,255,0)
>
> but I'm asking too much maybe. :-)
>

This should be doable. Similar kinds of tricks were also brought up at the
summit after Ira's talk -  like "padding" any gaps with the corresponding
identity operation. Another example that comes to mind in this context is
if you have, say:
   c[i] = a[i] + b[i]
   c[i+1] = a[i+1] - b[i+1]
   c[i+2] = a[i+2] + b[i+2]
   c[i+3] = a[i+3] - b[i+3]
This is also a case of non isomorphic operations (that actually some SIMD
platforms that have subadd operation can directly support), that could be
vectorized by negating the even locations of array b and then using a
vector add. So, yes, the transformation you mention is definitely a
relevant direction for extending this work.

dorit


> Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]