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-skip-if "AArch64 tiny code model does not support programs larger than 1MiB" {aarch64_tiny} } */
5 /* { dg-add-options bind_pic_locally } */
6
7 #include <stdarg.h>
8 #include "tree-vect.h"
9
10 #define N 64
11
12 struct s{
13 int m;
14 int n[N][N][N];
15 };
16
17 struct test1{
18 struct s a; /* array a.n is unaligned */
19 int b;
20 int c;
21 struct s e; /* array e.n is aligned */
22 };
23
24 struct test1 tmp1;
25
26 __attribute__ ((noinline))
27 int main1 ()
28 {
29 int i,j;
30
31 /* 1. unaligned */
32 for (i = 0; i < N; i++)
33 {
34 tmp1.a.n[1][2][i] = 5;
35 }
36
37 /* check results: */
38 for (i = 0; i <N; i++)
39 {
40 if (tmp1.a.n[1][2][i] != 5)
41 abort ();
42 }
43
44 /* 2. aligned */
45 for (i = 3; i < N-1; i++)
46 {
47 tmp1.a.n[1][2][i] = 6;
48 }
49
50 /* check results: */
51 for (i = 3; i < N-1; i++)
52 {
53 if (tmp1.a.n[1][2][i] != 6)
54 abort ();
55 }
56
57 /* 3. aligned */
58 for (i = 0; i < N; i++)
59 {
60 tmp1.e.n[1][2][i] = 7;
61 }
62
63 /* check results: */
64 for (i = 0; i < N; i++)
65 {
66 if (tmp1.e.n[1][2][i] != 7)
67 abort ();
68 }
69
70 /* 4. unaligned */
71 for (i = 3; i < N-3; i++)
72 {
73 tmp1.e.n[1][2][i] = 8;
74 }
75
76 /* check results: */
77 for (i = 3; i <N-3; i++)
78 {
79 if (tmp1.e.n[1][2][i] != 8)
80 abort ();
81 }
82
83 return 0;
84 }
85
86 int main (void)
87 {
88 check_vect ();
89
90 return main1 ();
91 }
92
93 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
94 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
95 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target { {! vect_aligned_arrays} && {vect_sizes_32B_16B} } } } } */
96 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { {vect_aligned_arrays} && {! vect_sizes_32B_16B} } } } } */