Altivec strangeness?
Jakub Jelinek
jakub@redhat.com
Mon Feb 25 01:59:00 GMT 2002
On Fri, Feb 22, 2002 at 04:55:00PM +0100, Daniel Egger wrote:
> I believe test2 should work and I added test3 only to try
> whether the warning goes away.
>
> And further: How do I initialize a vector with the same value
> to all elements?
> static const vector signed short foo = {1};
> gives me {1, 0, 0, 0, 0, 0, 0, 0, 0} as result which is loaded
> from memory whilst a vector splat might be more efficient here.
If you just want to save typing, with recent Aldy's patch:
static const vector signed short foo = { [0 ... 7] = 1 };
should work (but you have to know how many elements it has, and it
is a GNU extension).
The result will be the same as { 1, 1, 1, 1, 1, 1, 1, 1 } though,
so it will load the constant from memory as well.
Jakub
More information about the Gcc
mailing list