2017-07-31 Steve Ellcey <sellcey@cavium.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / section-anchors-vect-69.c
blob26bcf4b0d76517df2cfd772f966abc22c1c7314e
1 /* { dg-require-effective-target section_anchors } */
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 32
9 struct s{
10 int m;
11 int n[N][N][N];
14 struct s2{
15 int m;
16 int n[N-1][N-1][N-1];
19 struct test1{
20 struct s a; /* array a.n is unaligned */
21 int b;
22 int c;
23 struct s e; /* array e.n is aligned */
26 struct test2{
27 struct s2 a; /* array a.n is unaligned */
28 int b;
29 int c;
30 struct s2 e; /* array e.n is aligned */
34 struct test1 tmp1[4];
35 struct test2 tmp2[4];
37 int main1 ()
39 int i,j;
41 /* 1. unaligned */
42 for (i = 0; i < N; i++)
44 tmp1[2].a.n[1][2][i] = 5;
47 /* check results: */
48 for (i = 0; i <N; i++)
50 if (tmp1[2].a.n[1][2][i] != 5)
51 abort ();
54 /* 2. aligned */
55 for (i = 3; i < N-1; i++)
57 tmp1[2].a.n[1][2][i] = 6;
60 /* check results: */
61 for (i = 3; i < N-1; i++)
63 if (tmp1[2].a.n[1][2][i] != 6)
64 abort ();
67 /* 3. aligned */
68 for (i = 0; i < N; i++)
70 for (j = 0; j < N; j++)
72 tmp1[2].e.n[1][i][j] = 8;
76 /* check results: */
77 for (i = 0; i < N; i++)
79 for (j = 0; j < N; j++)
81 if (tmp1[2].e.n[1][i][j] != 8)
82 abort ();
86 /* 4. unaligned */
87 for (i = 0; i < N-4; i++)
89 for (j = 0; j < N-4; j++)
91 tmp2[2].e.n[1][i][j] = 8;
95 /* check results: */
96 for (i = 0; i < N-4; i++)
98 for (j = 0; j < N-4; j++)
100 if (tmp2[2].e.n[1][i][j] != 8)
101 abort ();
105 return 0;
108 int main (void)
110 check_vect ();
112 return main1 ();
115 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_int } } } */
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 versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */