Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-31-big-array.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 256
8
9 struct t{
10 int k[N];
11 int l;
12 };
13
14 struct s{
15 char a; /* aligned */
16 char b[N-1]; /* unaligned (offset 1B) */
17 char c[N]; /* aligned (offset NB) */
18 struct t d; /* aligned (offset 2NB) */
19 struct t e; /* unaligned (offset 2N+4N+4 B) */
20 };
21
22 __attribute__ ((noinline))
23 int main1 ()
24 {
25 int i;
26 struct s tmp;
27
28 /* unaligned */
29 for (i = 0; i < N/2; i++)
30 {
31 tmp.b[i] = 5;
32 }
33
34 /* check results: */
35 #pragma GCC novector
36 for (i = 0; i <N/2; i++)
37 {
38 if (tmp.b[i] != 5)
39 abort ();
40 }
41
42 /* aligned */
43 for (i = 0; i < N/2; i++)
44 {
45 tmp.c[i] = 6;
46 }
47
48 /* check results: */
49 #pragma GCC novector
50 for (i = 0; i <N/2; i++)
51 {
52 if (tmp.c[i] != 6)
53 abort ();
54 }
55
56 /* aligned */
57 for (i = 0; i < N/2; i++)
58 {
59 tmp.d.k[i] = 7;
60 }
61
62 /* check results: */
63 #pragma GCC novector
64 for (i = 0; i <N/2; i++)
65 {
66 if (tmp.d.k[i] != 7)
67 abort ();
68 }
69
70 /* unaligned */
71 for (i = 0; i < N/2; i++)
72 {
73 tmp.e.k[i] = 8;
74 }
75
76 /* check results: */
77 #pragma GCC novector
78 for (i = 0; i <N/2; i++)
79 {
80 if (tmp.e.k[i] != 8)
81 abort ();
82 }
83
84 return 0;
85 }
86
87 int main (void)
88 {
89 check_vect ();
90
91 return main1 ();
92 }
93
94 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
95 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */