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: front end changes for altivec


On Nov 27, 2001, Richard Henderson <rth@redhat.com> wrote:

> On Tue, Nov 27, 2001 at 06:59:35PM -0600, Aldy Hernandez wrote:
>> why can't you have sizeof((vector int))?

> Oh, you mean vector_width == sizeof(vector int) / sizeof(int)?
> Um, I guess that works.

> But what do you do with

> 	vector int x = (vector int){ 1, 2, 3, 4 };

> when a vector is only two elements wide?

How about requiring that variables of type vector always be arrays
with their actual number of elements explicitly specified, or inferred
from the initializer?

We could still support implicit iteration over vector elements for
operations such as copying, addition and subtraction, relieving the
source code from the need to worry about the exact vector size, while
still allowing code to pick into it somehow, for example:

vector int x[] = { 1, 2, 3, 4, 5, 6, 7 }; // probably pads with 0s

vector int y[7];

...

  y = x;
  y = x + y; 

I'm unsure whether indexing such an array (x[n]) would get you the nth
int or the nth vector element.  I'm inclined to prefer the latter,
even though it's a bit odd that you wouldn't be able to get x[6] on
the vector above unless the machine didn't support any int-type vector
mode, such that the int vector size is 1.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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