1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
3 
4 #include <stdarg.h>
5 #include "tree-vect.h"
6 
7 #if VECTOR_BITS > 128
8 #define NINTS (VECTOR_BITS / 32)
9 #else
10 #define NINTS 4
11 #endif
12 
13 #define N (NINTS * 6)
14 
15 /* Keep execution time down.  */
16 #if N <= 24
17 #define OUTERN N
18 #else
19 #define OUTERN NINTS
20 #endif
21 
22 struct s{
23   int m;
24   int n[4][4][N];
25 };
26 
27 struct test1{
28   struct s a; /* array a.n is unaligned */
29   int b;
30   int c;
31   struct s e[N]; /* array e.n is aligned */
32 };
33 
34 /* Avoid big local temporaries.  */
35 #if NINTS > 8
36 struct test1 tmp1;
37 #endif
38 
39 __attribute__ ((noinline))
main1()40 int main1 ()
41 {
42   int i,j;
43 #if NINTS <= 8
44   struct test1 tmp1;
45 #endif
46 
47   for (i = 0; i < OUTERN; i++)
48     for (j = NINTS - 1; j < N - NINTS + 1; j++)
49       {
50         tmp1.e[i].n[1][2][j] = 8;
51       }
52 
53   /* check results:  */
54   for (i = 0; i < OUTERN; i++)
55     for (j = NINTS - 1; j < N - NINTS + 1; j++)
56     {
57       if (tmp1.e[i].n[1][2][j] != 8)
58           abort ();
59     }
60 
61   /* not consecutive, will use strided stores */
62   for (i = 0; i < OUTERN; i++)
63     for (j = NINTS - 1; j < N - NINTS + 1; j++)
64       {
65         tmp1.e[j].n[1][2][j] = 8;
66       }
67 
68   /* check results:  */
69   for (i = 0; i < OUTERN; i++)
70     for (j = NINTS - 1; j < N - NINTS + 1; j++)
71     {
72       if (tmp1.e[j].n[1][2][j] != 8)
73           abort ();
74     }
75 
76   return 0;
77 }
78 
main(void)79 int main (void)
80 {
81   check_vect ();
82 
83   return main1 ();
84 }
85 
86 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
87 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" {target {{! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
88