Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-115.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
9 struct s{
10 int b[N];
11 int c[N];
12 int m;
13 };
14
15 struct t{
16 struct s strc_s;
17 int m;
18 };
19
20 struct test1{
21 struct t strc_t;
22 struct t *ptr_t;
23 int k;
24 int l;
25 };
26
27 int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
28
29 __attribute__ ((noinline))
30 int main1 ()
31 {
32 int i;
33 struct test1 tmp1;
34 struct t tmp2;
35
36 tmp1.ptr_t = &tmp2;
37
38 /* DR bases comparison: record and array. */
39 for (i = 0; i < N; i++)
40 {
41 tmp1.strc_t.strc_s.b[i] = a[i];
42 }
43
44 /* Check results. */
45 #pragma GCC novector
46 for (i = 0; i < N; i++)
47 {
48 if (tmp1.strc_t.strc_s.b[i] != a[i])
49 abort();
50 }
51
52 /* DR bases comparison: record containing ptr and array. */
53 for (i = 0; i < N; i++)
54 {
55 tmp1.ptr_t->strc_s.c[i] = a[i];
56 }
57
58 /* Check results. */
59 #pragma GCC novector
60 for (i = 0; i < N; i++)
61 {
62 if (tmp1.ptr_t->strc_s.c[i] != a[i])
63 abort();
64 }
65
66
67 return 0;
68 }
69
70 int main (void)
71 {
72 check_vect ();
73
74 return main1 ();
75 }
76
77 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
78
79
80 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */