Debian Codegraph @

gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
3 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
4
5 #include <stdarg.h>
6 #include "tree-vect.h"
7
8 #if VECTOR_BITS > 128
9 #define NINTS (VECTOR_BITS / 32)
10 #else
11 #define NINTS 4
12 #endif
13
14 #define N (NINTS * 6)
15
16 struct s{
17 int m;
18 int n[N][N][N];
19 };
20
21 struct s2{
22 int m;
23 int n[N-1][N-1][N-1];
24 };
25
26 struct test1{
27 struct s a; /* array a.n is unaligned */
28 int pad[NINTS - 2];
29 struct s e; /* array e.n is aligned */
30 };
31
32 struct test2{
33 struct s2 a; /* array a.n is unaligned */
34 int b;
35 int c;
36 struct s2 e; /* array e.n is aligned */
37 };
38
39
40 struct test1 tmp1[4];
41 struct test2 tmp2[4];
42
43 __attribute__ ((noinline))
44 int main1 ()
45 {
46 int i,j;
47
48 /* 1. unaligned (known misalignment) */
49 for (i = 0; i < N; i++)
50 {
51 tmp1[2].a.n[1][2][i] = 5;
52 }
53
54 /* check results: */
55 #pragma GCC novector
56 for (i = 0; i <N; i++)
57 {
58 if (tmp1[2].a.n[1][2][i] != 5)
59 abort ();
60 }
61
62 /* 2. aligned */
63 for (i = NINTS - 1; i < N - 1; i++)
64 {
65 tmp1[2].a.n[1][2][i] = 6;
66 }
67
68 /* check results: */
69 #pragma GCC novector
70 for (i = NINTS; i < N - 1; i++)
71 {
72 if (tmp1[2].a.n[1][2][i] != 6)
73 abort ();
74 }
75
76 /* 3. aligned */
77 for (i = 0; i < N; i++)
78 {
79 for (j = 0; j < N; j++)
80 {
81 tmp1[2].e.n[1][i][j] = 8;
82 }
83 }
84
85 /* check results: */
86 for (i = 0; i < N; i++)
87 {
88 #pragma GCC novector
89 for (j = 0; j < N; j++)
90 {
91 if (tmp1[2].e.n[1][i][j] != 8)
92 abort ();
93 }
94 }
95
96 /* 4. unaligned (unknown misalignment) */
97 for (i = 0; i < N - NINTS; i++)
98 {
99 for (j = 0; j < N - NINTS; j++)
100 {
101 tmp2[2].e.n[1][i][j] = 8;
102 }
103 }
104
105 /* check results: */
106 for (i = 0; i < N - NINTS; i++)
107 {
108 #pragma GCC novector
109 for (j = 0; j < N - NINTS; j++)
110 {
111 if (tmp2[2].e.n[1][i][j] != 8)
112 abort ();
113 }
114 }
115
116 return 0;
117 }
118
119 int main (void)
120 {
121 check_vect ();
122
123 return main1 ();
124 }
125
126 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target vect_hw_misalign } } } */
127 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_hw_misalign } } } } */
128 /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { ! vector_alignment_reachable } && { ! vect_hw_misalign } } } } } */