OSDN Git Service

Merge lto branch into trunk.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / vector-1.c
1 /* Check that vector extraction works correctly. */
2
3 #define vector __attribute__((vector_size(16) ))
4
5 int f0(vector int t)
6 {
7   return ((int*)&t)[0];
8 }
9 int f1(vector int t)
10 {
11   return ((int*)&t)[1];
12 }
13 int f2(vector int t)
14 {
15   return ((int*)&t)[2];
16 }
17 int f3(vector int t)
18 {
19   return ((int*)&t)[3];
20 }
21 int main(void)
22 {
23   vector int a = {0, 1, 2, 3};
24   /* Make sure that we have the correct size for the vectors. */
25   if (sizeof(int) != 4)
26     __builtin_exit (0);
27   if (f0(a) != 0)
28     __builtin_abort ();
29   if (f1(a) != 1)
30     __builtin_abort ();
31   if (f2(a) != 2)
32     __builtin_abort ();
33   if (f3(a) != 3)
34     __builtin_abort ();
35   return 0;
36 }