public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Altivec strangeness?
@ 2002-02-22  8:25 Daniel Egger
  2002-02-22 14:36 ` Aldy Hernandez
  2002-02-25  1:59 ` Jakub Jelinek
  0 siblings, 2 replies; 10+ messages in thread
From: Daniel Egger @ 2002-02-22  8:25 UTC (permalink / raw)
  To: GCC Developer Mailinglist; +Cc: Aldy Hernandez

Hija,

I'm fooling around with altivec and tried to convert my sources, thereby
I discovered the following strangeness:

#include <altivec.h>

static const vector signed short test = {1, 2, 3, 4, 5, 6, 7, 8};

static const vector signed short test2[2] =
{
    {1, 2, 3, 4, 5, 6, 7, 8},
    {1, 2, 3, 4, 5, 6, 7, 8}
};

static const vector signed short test3[2] =
{
    {(1, 2, 3, 4, 5, 6, 7, 8)},
    {(1, 2, 3, 4, 5, 6, 7, 8)}
};

gives:

test.c:7: warning: braces around scalar initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:7: warning: excess elements in vector initializer
test.c:7: warning: (near initialization for `test2[0]')
test.c:8: warning: braces around scalar initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:8: warning: excess elements in vector initializer
test.c:8: warning: (near initialization for `test2[1]')
test.c:13: warning: braces around scalar initializer
test.c:13: warning: (near initialization for `test3[0]')
test.c:14: warning: braces around scalar initializer
test.c:14: warning: (near initialization for `test3[1]')

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.

-- 
Servus,
       Daniel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-02-26  2:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-22  8:25 Altivec strangeness? Daniel Egger
2002-02-22 14:36 ` Aldy Hernandez
2002-02-23 16:50   ` Daniel Egger
2002-02-24 16:00     ` Aldy Hernandez
2002-02-24 16:41       ` Daniel Egger
2002-02-24 18:16         ` Aldy Hernandez
2002-02-25  9:11           ` Daniel Egger
2002-02-25 18:46             ` Aldy Hernandez
2002-02-25  1:59 ` Jakub Jelinek
2002-02-25  7:17   ` Daniel Egger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).