libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-31.c
blob6c4e0f12cff4b55664ac7c7cc47c9bfd578e0d8a
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 32
9 struct t{
10 int k[N];
11 int l;
14 struct s{
15 char a; /* aligned */
16 char b[N-1]; /* unaligned (offset 1B) */
17 char c[N]; /* aligned (offset NB) */
18 struct t d; /* aligned (offset 2NB) */
19 struct t e; /* unaligned (offset 2N+4N+4 B) */
22 __attribute__ ((noinline))
23 int main1 ()
25 int i;
26 struct s tmp;
28 /* unaligned */
29 for (i = 0; i < N/2; i++)
31 tmp.b[i] = 5;
34 /* check results: */
35 #pragma GCC novector
36 for (i = 0; i <N/2; i++)
38 if (tmp.b[i] != 5)
39 abort ();
42 /* aligned */
43 for (i = 0; i < N/2; i++)
45 tmp.c[i] = 6;
48 /* check results: */
49 #pragma GCC novector
50 for (i = 0; i <N/2; i++)
52 if (tmp.c[i] != 6)
53 abort ();
56 /* aligned */
57 for (i = 0; i < N/2; i++)
59 tmp.d.k[i] = 7;
62 /* check results: */
63 #pragma GCC novector
64 for (i = 0; i <N/2; i++)
66 if (tmp.d.k[i] != 7)
67 abort ();
70 /* unaligned */
71 for (i = 0; i < N/2; i++)
73 tmp.e.k[i] = 8;
76 /* check results: */
77 #pragma GCC novector
78 for (i = 0; i <N/2; i++)
80 if (tmp.e.k[i] != 8)
81 abort ();
84 return 0;
87 int main (void)
89 check_vect ();
91 return main1 ();
94 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
95 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */