Why are vectors not arrays?

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Sat Apr 10 10:52:00 GMT 2004


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



More information about the Gcc mailing list