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: Altivec strangeness?


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


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