This is the mail archive of the gcc@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: Vector indexing patch


On Tue, Jun 1, 2010 at 12:21 PM, Artem Shinkarov
<artyom.shinkaroff@gmail.com> wrote:
> This is a reworked patch of Andrew Pinski "Subscripting on vector
> types" in terms of GSoC 2010 [Artjoms Sinkarovs].
>
> This patch allows to index individual elements of vector type in C.
> For example: vec[i], where vec is a vector with a base type T and i is
> an integer type.
> If i is a constant then we construct a BIT_FIELD_REF node considering
> boundchecking, otherwise we expand it to (((T *)&(vec))[i]).

Creating BIT_FIELD_REF early will break:

#define vector __attribute__((__vector_size__(sizeof(int)*4)))
vector int t;
int *f(void)
{
  return &t[0];
}

Which was working with my patch.  I think you should just allow
gimplifier (which calls fold_indirect_ref) create BIT_FIELD_REF and
allow the rest of the middle remove TREE_ADDRESSABLE.  The middle-end
already knows how to remove TREE_ADDRESSABLE and set the gimple reg on
the decs which need it; I implemented those improvements already.

Thanks,
Andrew Pinski


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