1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
3 
4 #include <stdarg.h>
5 #include "tree-vect.h"
6 
7 #define N 16
8 
9 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
10 int ia[N][4][N+1];
11 int ic[N][N][3][2*N+2];
12 int id[N][N][N+4];
13 
14 __attribute__ ((noinline))
main1()15 int main1 ()
16 {
17   int i, j;
18 
19   /* Multidimensional array. Not aligned: vectorizable. */
20   for (i = 0; i < N; i++)
21     {
22       for (j = 0; j < N; j++)
23         {
24            ia[i][1][j] = ib[i];
25         }
26     }
27 
28   /* Multidimensional array. Aligned: vectorizable. */
29   for (i = 0; i < N; i++)
30     {
31       for (j = 0; j < N; j++)
32         {
33            ic[i][1][1][j] = ib[i];
34         }
35     }
36 
37   /* Multidimensional array. Not aligned: vectorizable. */
38   for (i = 0; i < N; i++)
39     {
40       for (j = 0; j < N; j++)
41         {
42            id[i][1][j+1] = ib[i];
43         }
44     }
45 
46   /* check results: */
47   for (i = 0; i < N; i++)
48     {
49       for (j = 0; j < N; j++)
50         {
51            if (ia[i][1][j] != ib[i])
52               abort();
53         }
54     }
55 
56   /* check results: */
57   for (i = 0; i < N; i++)
58     {
59       for (j = 0; j < N; j++)
60         {
61            if (ic[i][1][1][j] != ib[i])
62               abort();
63         }
64     }
65 
66   /* check results: */
67   for (i = 0; i < N; i++)
68     {
69       for (j = 0; j < N; j++)
70         {
71            if (id[i][1][j+1] != ib[i])
72               abort();
73         }
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 3 loops" 1 "vect" } } */
87 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
88 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */
89