Why are vectors not arrays?
Daniel Berlin
dberlin@dberlin.org
Fri Apr 9 14:49:00 GMT 2004
On Apr 9, 2004, at 10:04 AM, Ian Lance Taylor wrote:
> This may be a dumb question, but why doesn't this work?
Nobody implemented it.
It was on the list when we originally did these extensions.
>
> typedef int v2si __attribute__ ((vector_size (8)));
> int foo (v2si v) { return v[0]; }
>
> I get:
>
> foo2.c: In function `foo':
> foo2.c:2: error: subscripted value is neither array nor pointer
>
> 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?
No, and there should be. If there was, i'd add code to bitmap.c and
sbitmap.c so that they were implemented also in terms of our generic
vector support, and have it use that version if we were compiling with
an appropriate GCC for starters (and obviously when we compile with
stage1 or stage2).
That should be a good test of generic vector support (both hardware
assisted and not hardware assisted)
>
More information about the Gcc
mailing list