Debian Codegraph @

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

raw
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-add-options bind_pic_locally } */
5
6 #include <stdarg.h>
7 #include "tree-vect.h"
8
9 /* N / 2 bytes has to be worth vectorizing even with peeling. */
10 #if VECTOR_BITS > 128
11 #define N (VECTOR_BITS * 4 / 8)
12 #else
13 #define N 64
14 #endif
15
16 struct t{
17 int k[N];
18 int l;
19 };
20
21 struct s{
22 char a; /* aligned */
23 char b[N-1]; /* unaligned (offset 1B) */
24 char c[N]; /* aligned (offset NB) */
25 struct t d; /* aligned (offset 2NB) */
26 struct t e; /* unaligned (offset 2N+4N+4 B) */
27 };
28
29 struct s tmp;
30 __attribute__ ((noinline))
31 int main1 ()
32 {
33 int i;
34
35 /* unaligned */
36 for (i = 0; i < N/2; i++)
37 {
38 tmp.b[i] = 5;
39 }
40
41 /* check results: */
42 #pragma GCC novector
43 for (i = 0; i <N/2; i++)
44 {
45 if (tmp.b[i] != 5)
46 abort ();
47 }
48
49 /* aligned */
50 for (i = 0; i < N/2; i++)
51 {
52 tmp.c[i] = 6;
53 }
54
55 /* check results: */
56 #pragma GCC novector
57 for (i = 0; i <N/2; i++)
58 {
59 if (tmp.c[i] != 6)
60 abort ();
61 }
62
63 /* aligned */
64 for (i = 0; i < N/2; i++)
65 {
66 tmp.d.k[i] = 7;
67 }
68
69 /* check results: */
70 #pragma GCC novector
71 for (i = 0; i <N/2; i++)
72 {
73 if (tmp.d.k[i] != 7)
74 abort ();
75 }
76
77 /* unaligned */
78 for (i = 0; i < N/2; i++)
79 {
80 tmp.e.k[i] = 8;
81 }
82
83 /* check results: */
84 #pragma GCC novector
85 for (i = 0; i <N/2; i++)
86 {
87 if (tmp.e.k[i] != 8)
88 abort ();
89 }
90
91 return 0;
92 }
93
94 int main (void)
95 {
96 check_vect ();
97
98 return main1 ();
99 }
100
101 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
102 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
103 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail vect_element_align_preferred } } } */