This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Altivec strangeness?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Daniel Egger <degger at fhm dot edu>
- Cc: GCC Developer Mailinglist <gcc at gcc dot gnu dot org>, Aldy Hernandez <aldyh at redhat dot com>
- Date: Mon, 25 Feb 2002 10:49:59 +0100
- Subject: Re: Altivec strangeness?
- References: <1014393311.11938.31.camel@sonja>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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