annotate gcc/testsuite/c-c++-common/vector-init-2.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do run } */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* PR C/31499, test that the C front-end treats vectors like an array
kono
parents:
diff changeset
4 and that it works at runtime. */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 #define vector __attribute__((__vector_size__(4*sizeof(int)) ))
kono
parents:
diff changeset
7 vector signed int v1[]={0,1,2,3,4,5,6,7};
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int main(void)
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 int i;
kono
parents:
diff changeset
13 for (i = 0; i < sizeof(v1)/sizeof(v1[0]); i++)
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 vector int t = v1[i];
kono
parents:
diff changeset
16 int *d = (int*)&t;
kono
parents:
diff changeset
17 int j;
kono
parents:
diff changeset
18 for (j = 0; j < 4; j++)
kono
parents:
diff changeset
19 {
kono
parents:
diff changeset
20 if (d[j] != i * 4 + j)
kono
parents:
diff changeset
21 __builtin_abort ();
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23 }
kono
parents:
diff changeset
24 return 0;
kono
parents:
diff changeset
25 }