summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-alias-check-3.c
blob: 10b4c3d2c2abb8045178e936dd1e4d038ea0c89c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "--param vect-max-version-for-alias-checks=0 -fopenmp-simd" } */

/* Intended to be larger than any VF.  */
#define GAP 128
#define N (GAP * 3)

struct s { int x[N + 1]; };
struct t { struct s x[N + 1]; };
struct u { int x[N + 1]; int y; };
struct v { struct s s; };

void
f1 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a->x[i] += b->x[i];
}

void
f2 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[1].x[i] += b[2].x[i];
}

void
f3 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[1].x[i] += b[i].x[i];
}

void
f4 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[i].x[i] += b[i].x[i];
}

void
f5 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a->x[i] += b->x[i + 1];
}

void
f6 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[1].x[i] += b[2].x[i + 1];
}

void
f7 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[1].x[i] += b[i].x[i + 1];
}

void
f8 (struct s *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a[i].x[i] += b[i].x[i + 1];
}

void
f9 (struct s *a, struct t *b)
{
  for (int i = 0; i < N; ++i)
    a->x[i] += b->x[1].x[i];
}

void
f10 (struct s *a, struct t *b)
{
  for (int i = 0; i < N; ++i)
    a->x[i] += b->x[i].x[i];
}

void
f11 (struct u *a, struct u *b)
{
  for (int i = 0; i < N; ++i)
    a->x[i] += b->x[i] + b[i].y;
}

void
f12 (struct s *a, struct s *b)
{
  for (int i = 0; i < GAP; ++i)
    a->x[i + GAP] += b->x[i];
}

void
f13 (struct s *a, struct s *b)
{
  for (int i = 0; i < GAP * 2; ++i)
    a->x[i + GAP] += b->x[i];
}

void
f14 (struct v *a, struct s *b)
{
  for (int i = 0; i < N; ++i)
    a->s.x[i] = b->x[i];
}

void
f15 (struct s *a, struct s *b)
{
  #pragma omp simd safelen(N)
  for (int i = 0; i < N; ++i)
    a->x[i + 1] += b->x[i];
}

/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 15 "vect" } } */