OSDN Git Service

Fix vect-shuffle-* test cases.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / vect-shuffle-1.c
1 #if __SIZEOF_INT__ == 4
2 typedef unsigned int V __attribute__((vector_size(16), may_alias));
3
4 struct S
5 {
6   V in, mask, out;
7 };
8
9 struct S tests[] = {
10   {
11     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
12     { 0, 1, 2, 3 },
13     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
14   },
15   {
16     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
17     { 0+1*4, 1+2*4, 2+3*4, 3+4*4 },
18     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
19   },
20   {
21     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
22     { 3, 2, 1, 0 },
23     { 0x44444444, 0x33333333, 0x22222222, 0x11111111 },
24   },
25   {
26     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
27     { 0, 3, 2, 1 },
28     { 0x11111111, 0x44444444, 0x33333333, 0x22222222 },
29   },
30   {
31     { 0x11111111, 0x22222222, 0x33333333, 0x44444444 },
32     { 0, 2, 1, 3 },
33     { 0x11111111, 0x33333333, 0x22222222, 0x44444444 },
34   },
35   {
36     { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 },
37     { 3, 1, 2, 0 },
38     { 0xddeeff00, 0x55667788, 0x99aabbcc, 0x11223344 },
39   },
40   {
41     { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 },
42     { 0, 0, 0, 0 },
43     { 0x11223344, 0x11223344, 0x11223344, 0x11223344 },
44   },
45   {
46     { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 },
47     { 1, 2, 1, 2 },
48     { 0x55667788, 0x99aabbcc, 0x55667788, 0x99aabbcc },
49   }
50 };
51
52 extern void abort(void);
53
54 int main()
55 {
56   int i;
57
58   for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i)
59     {
60       V r = __builtin_shuffle(tests[i].in, tests[i].mask);
61       if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0)
62         abort();
63     }
64
65   return 0;
66 }
67
68 #endif /* SIZEOF_INT */