Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-65.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 16
8 #define M 4
9
10 __attribute__ ((noinline))
11 int main1 ()
12 {
13 int i, j;
14 int ib[M][M][N] = {{{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
15 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
16 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
17 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
18 {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
19 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
20 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
21 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
22 {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
23 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
24 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
25 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}},
26 {{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
27 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
28 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45},
29 {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}}};
30 int ia[M][M][N];
31 int ic[N];
32
33 /* Multidimensional array. Aligned. The "inner" dimensions
34 are invariant in the inner loop. Load and store. */
35 for (i = 0; i < M; i++)
36 {
37 for (j = 0; j < N; j++)
38 {
39 ia[i][1][j] = ib[2][i][j];
40 }
41 }
42
43 /* check results: */
44 for (i = 0; i < M; i++)
45 {
46 #pragma GCC novector
47 for (j = 0; j < N; j++)
48 {
49 if (ia[i][1][j] != ib[2][i][j])
50 abort();
51 }
52 }
53
54 /* Multidimensional array. Aligned. The "inner" dimensions
55 are invariant in the inner loop. Load. */
56 for (i = 0; i < M; i++)
57 {
58 for (j = 0; j < N; j++)
59 {
60 ic[j] = ib[2][i][j];
61 }
62 }
63
64 /* check results: */
65 for (i = 0; i < M; i++)
66 {
67 #pragma GCC novector
68 for (j = 0; j < N; j++)
69 {
70 if (ic[j] != ib[2][i][j])
71 abort();
72 }
73 }
74
75 return 0;
76 }
77
78 int main (void)
79 {
80 check_vect ();
81
82 return main1 ();
83 }
84
85 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
86 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */