111
|
1 /* { dg-require-effective-target vect_int } */
|
|
2
|
|
3 #include <stdarg.h>
|
|
4 #include "tree-vect.h"
|
|
5
|
|
6 #define N 16
|
|
7
|
|
8 __attribute__ ((noinline))
|
|
9 int main1 ()
|
|
10 {
|
|
11 int i, j;
|
|
12 int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
|
|
13 int ia[N][4][N+8];
|
|
14
|
|
15 /* Multidimensional array. Aligned. The "inner" dimensions
|
|
16 are invariant in the inner loop. Store. */
|
|
17 for (i = 0; i < N; i++)
|
|
18 {
|
|
19 for (j = 0; j < N; j++)
|
|
20 {
|
|
21 ia[i][1][j+8] = ib[i];
|
|
22 }
|
|
23 }
|
|
24
|
|
25 /* check results: */
|
|
26 for (i = 0; i < N; i++)
|
|
27 {
|
|
28 for (j = 0; j < N; j++)
|
|
29 {
|
|
30 if (ia[i][1][j+8] != ib[i])
|
|
31 abort();
|
|
32 }
|
|
33 }
|
|
34
|
|
35 /* Multidimensional array. Aligned. The "inner" dimensions
|
|
36 are invariant in the inner loop. The outer loop is
|
|
37 vectorizable after invariant/store motion. */
|
|
38 for (i = 0; i < N; i++)
|
|
39 {
|
|
40 for (j = 0; j < N; j++)
|
|
41 {
|
|
42 ia[i][1][8] = 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][8] != ib[i])
|
|
52 abort();
|
|
53 }
|
|
54 }
|
|
55
|
|
56
|
|
57 return 0;
|
|
58 }
|
|
59
|
|
60 int main (void)
|
|
61 {
|
|
62 check_vect ();
|
|
63
|
|
64 return main1 ();
|
|
65 }
|
|
66
|
|
67 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
|
131
|
68 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { xfail { ! vect_align_stack_vars } } } } */
|