This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why are vectors not arrays?
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Daniel Berlin <dberlin at dberlin dot org>,Ian Lance Taylor <ian at wasabisystems dot com>, gcc at gcc dot gnu dot org
- Date: Sat, 10 Apr 2004 08:20:49 +0200
- Subject: Re: Why are vectors not arrays?
- References: <20040410002225.GA5734@redhat.com>
Hello,
> On Fri, Apr 09, 2004 at 10:29:25AM -0400, Daniel Berlin wrote:
> > >We have vector extensions which support addition, subtraction, and so
> > >forth, which is great, but is there any simple way to actually get
> > >values in and out of vectors?
>
> A union?
>
> > No, and there should be.
>
> Why?
>
> What we definitely do NOT want is for the bits of a vector to
> be considered lvalues. We do NOT want to be able to take their
> address.
>
> Why?
>
> Because that means all sorts of nasty business when it comes
> to figuring out whether or not we can actually use hw vector
> types and operations. It means that suddenly all vector
> variables are aggregates and not a queer sort of scalar. Which
> means that SSA optimization will SUCK because they can't be
> renamed. At least without rewriting a lot of stuff. And for
> what benefit?
>
> Without a REALLY good reason I oppose adding lvalue accessors
> to vector types. I'm rather annoyed that we have them for
> complex types as it is.
what exactly is the difference between using a union as you
propose and having proper lvalue accessors (except that the former
is much uglier to use and harder to optimize)?
Taking address of a part of the vector variable would indeed be nothing
great for optimizations; but this can be just forbidden (similarly as
you cannot take an address of a bitfield).
Zdenek