111
|
1 /* { dg-require-effective-target section_anchors } */
|
|
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
|
|
3
|
|
4 #include <stdarg.h>
|
|
5 #include "tree-vect.h"
|
|
6
|
131
|
7 #if VECTOR_BITS > 128
|
|
8 #define NINTS (VECTOR_BITS / 32)
|
|
9 #else
|
|
10 #define NINTS 4
|
|
11 #endif
|
|
12
|
|
13 #define N (NINTS * 8)
|
111
|
14
|
|
15 struct s{
|
|
16 int m;
|
|
17 int n[N][N][N];
|
|
18 };
|
|
19
|
|
20 struct s2{
|
|
21 int m;
|
|
22 int n[N-1][N-1][N-1];
|
|
23 };
|
|
24
|
|
25 struct test1{
|
|
26 struct s a; /* array a.n is unaligned */
|
131
|
27 int pad[NINTS - 2];
|
111
|
28 struct s e; /* array e.n is aligned */
|
|
29 };
|
|
30
|
|
31 struct test2{
|
131
|
32 struct s2 a;
|
111
|
33 int b;
|
|
34 int c;
|
131
|
35 struct s2 e;
|
111
|
36 };
|
|
37
|
|
38
|
|
39 struct test1 tmp1[4];
|
|
40 struct test2 tmp2[4];
|
|
41
|
|
42 int main1 ()
|
|
43 {
|
|
44 int i,j;
|
|
45
|
|
46 /* 1. unaligned */
|
|
47 for (i = 0; i < N; i++)
|
|
48 {
|
|
49 tmp1[2].a.n[1][2][i] = 5;
|
|
50 }
|
|
51
|
|
52 /* check results: */
|
|
53 for (i = 0; i <N; i++)
|
|
54 {
|
|
55 if (tmp1[2].a.n[1][2][i] != 5)
|
|
56 abort ();
|
|
57 }
|
|
58
|
|
59 /* 2. aligned */
|
131
|
60 for (i = NINTS - 1; i < N - 1; i++)
|
111
|
61 {
|
|
62 tmp1[2].a.n[1][2][i] = 6;
|
|
63 }
|
|
64
|
|
65 /* check results: */
|
131
|
66 for (i = NINTS - 1; i < N - 1; i++)
|
111
|
67 {
|
|
68 if (tmp1[2].a.n[1][2][i] != 6)
|
|
69 abort ();
|
|
70 }
|
|
71
|
|
72 /* 3. aligned */
|
|
73 for (i = 0; i < N; i++)
|
|
74 {
|
|
75 for (j = 0; j < N; j++)
|
|
76 {
|
|
77 tmp1[2].e.n[1][i][j] = 8;
|
|
78 }
|
|
79 }
|
|
80
|
|
81 /* check results: */
|
|
82 for (i = 0; i < N; i++)
|
|
83 {
|
|
84 for (j = 0; j < N; j++)
|
|
85 {
|
|
86 if (tmp1[2].e.n[1][i][j] != 8)
|
|
87 abort ();
|
|
88 }
|
|
89 }
|
|
90
|
|
91 /* 4. unaligned */
|
131
|
92 for (i = 0; i < N - NINTS; i++)
|
111
|
93 {
|
131
|
94 for (j = 0; j < N - NINTS; j++)
|
111
|
95 {
|
|
96 tmp2[2].e.n[1][i][j] = 8;
|
|
97 }
|
|
98 }
|
|
99
|
|
100 /* check results: */
|
131
|
101 for (i = 0; i < N - NINTS; i++)
|
111
|
102 {
|
131
|
103 for (j = 0; j < N - NINTS; j++)
|
111
|
104 {
|
|
105 if (tmp2[2].e.n[1][i][j] != 8)
|
|
106 abort ();
|
|
107 }
|
|
108 }
|
|
109
|
|
110 return 0;
|
|
111 }
|
|
112
|
|
113 int main (void)
|
|
114 {
|
|
115 check_vect ();
|
|
116
|
|
117 return main1 ();
|
|
118 }
|
|
119
|
|
120 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_int } } } */
|
|
121 /* Alignment forced using versioning until the pass that increases alignment
|
|
122 is extended to handle structs. */
|
|
123 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target {vect_int && {! vector_alignment_reachable} } } } } */
|