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][RFC] middle-end array expressions (II)


On Wed, 23 Apr 2008, Mark Mitchell wrote:

> Richard Guenther wrote:
> 
> > This is the final proposal for the introduction of arrays as first
> > class citizens of the middle-end. 
> 
> Thanks for working on this.
> 
> >   float Btmp[n] = VLA <n, 1> (B);
> >   float B1 = VLA_IDX <i> (Btmp);
> >   float B2 = VLA_IDX <i+2> (Btmp);
> >   float tmp = B1 + B2;
> >   float Atmp = VLA_RIDX <i> (tmp);
> >   VLA <n-2, 1> (A) = Atmp;
> 
> What you're doing here seems naturally to me, possibly because it's got some
> POOMA-esque aspects that are familiar to us both.  Do you know what
> representation is used in other compilers for array operations?  Kenny do you?

I don't know, but I'm curious ;)

> Why did you settle on using scalar placeholders, rather than full array
> operations, ala Fortran?

Because it makes the implementation way easier and allows to share lots
of optimization infrastructure with the scalar optimizers.  I made the
paper available at
http://www.suse.de/~rguenther/guenther.pdf
where I (try to) elaborate on the apporach some more.

> Can you easily express transpose in the above framework?  I think you can: you
> make a view of your target array that flips the strides between dimensions,
> and then assign into it.

Yes, a transpose would be

tmp_2 = VLA_IDX <i, j> (arr_1)
arr_2 = VLA_RIDX <j, i> (tmp_2)

of course most useful if you use the transpose in another computation.

> But, is that natural from a compilation point of
> view?

Natural enough to a scalarization pass at least.

Richard.


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