Add compile command to each testcase
[gcc-vect-testsuite.git] / section-anchors-vect-69.c
blob7b5ce734884fe253ca8b8246c0c7c9333a488af8
1 /* { dg-require-effective-target section_anchors } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 32
8 struct s{
9 int m;
10 int n[N][N][N];
13 struct s2{
14 int m;
15 int n[N-1][N-1][N-1];
18 struct test1{
19 struct s a; /* array a.n is unaligned */
20 int b;
21 int c;
22 struct s e; /* array e.n is aligned */
25 struct test2{
26 struct s2 a; /* array a.n is unaligned */
27 int b;
28 int c;
29 struct s2 e; /* array e.n is aligned */
33 struct test1 tmp1[4];
34 struct test2 tmp2[4];
36 int main1 ()
38 int i,j;
40 /* 1. unaligned */
41 for (i = 0; i < N; i++)
43 tmp1[2].a.n[1][2][i] = 5;
46 /* check results: */
47 for (i = 0; i <N; i++)
49 if (tmp1[2].a.n[1][2][i] != 5)
50 abort ();
53 /* 2. aligned */
54 for (i = 3; i < N-1; i++)
56 tmp1[2].a.n[1][2][i] = 6;
59 /* check results: */
60 for (i = 3; i < N-1; i++)
62 if (tmp1[2].a.n[1][2][i] != 6)
63 abort ();
66 /* 3. aligned */
67 for (i = 0; i < N; i++)
69 for (j = 0; j < N; j++)
71 tmp1[2].e.n[1][i][j] = 8;
75 /* check results: */
76 for (i = 0; i < N; i++)
78 for (j = 0; j < N; j++)
80 if (tmp1[2].e.n[1][i][j] != 8)
81 abort ();
85 /* 4. unaligned */
86 for (i = 0; i < N-4; i++)
88 for (j = 0; j < N-4; j++)
90 tmp2[2].e.n[1][i][j] = 8;
94 /* check results: */
95 for (i = 0; i < N-4; i++)
97 for (j = 0; j < N-4; j++)
99 if (tmp2[2].e.n[1][i][j] != 8)
100 abort ();
104 return 0;
107 int main (void)
109 check_vect ();
111 return main1 ();
114 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_int } } } */
115 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
116 /* Alignment forced using versioning until the pass that increases alignment
117 is extended to handle structs. */
118 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target {vect_int && vector_alignment_reachable } } } } */
119 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */
120 /* { dg-final { cleanup-tree-dump "vect" } } */