2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / vector-1.c
blobff21d68ca7be8e7cab83b57bd495f1aa788739bb
1 /* Check that vector extraction works correctly. */
3 #define vector __attribute__((vector_size(16) ))
5 int f0(vector int t)
7 return ((int*)&t)[0];
9 int f1(vector int t)
11 return ((int*)&t)[1];
13 int f2(vector int t)
15 return ((int*)&t)[2];
17 int f3(vector int t)
19 return ((int*)&t)[3];
21 int main(void)
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;