blob: 9e36aecca520a4367bcc12552580fb5814b4d3f4 (
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
121
122
123
124
125
126
127
128
|
/* { dg-do compile } */
/* { dg-options "-O1 -fscalar-evolutions -fdump-tree-scev-details -fall-data-deps -fdump-tree-ddall" } */
#define N 16
void fbar (float *);
void ibar (int *);
void sbar (short *);
/* Should be vectorized */
foo (int n)
{
float a[N+1];
float b[N];
float c[N];
float d[N];
int ia[N];
int ib[N];
int ic[N];
double da[N];
double db[N];
short sa[N];
short sb[N];
short sc[N];
int i,j;
int diff = 0;
char cb[N];
char cc[N];
char image[N][N];
char block[N][N];
/* Not vetorizable yet (unknown loop bound). */
for (i = 0; i < n; i++){
a[i] = b[i];
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i];
}
fbar (a);
/* Not Vectorizable (mode not supported). */
for (i = 0; i < N; i++){
da[i] = db[i];
}
fbar (a);
/* Not vetorizable yet (constant assignment). */
for (i = 0; i < N; i++){
a[i] = 5;
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i] + d[i];
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i] * c[i];
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N/2; i++){
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
d[i] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
}
fbar (a);
/* Not vetorizable yet (too conservative dependence test). */
for (i = 0; i < N/2; i++){
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
a[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
}
fbar (a);
/* Not vetorizable yet (access pattern). */
for (i = 0; i < N/2; i++){
a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
}
fbar (a);
/* Not vetorizable yet (too conservative dependence test; access pattern). */
for (i = 0; i < N/2; i++){
a[2*i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
a[2*i+1] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
}
fbar (a);
/* Not vetorizable yet (no support for integer mult). */
for (i = 0; i < N; i++){
ia[i] = ib[i] * ic[i];
}
ibar (ia);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i];
d[i] = b[i] + c[i];
ia[i] = ib[i] + ic[i];
}
ibar (ia);
fbar (a);
fbar (d);
/* Not vectorizable yet (two types with different nunits in vector). */
for (i = 0; i < N; i++){
ia[i] = ib[i] + ic[i];
sa[i] = sb[i] + sc[i];
}
ibar (ia);
sbar (sa);
/* Not vetorizable yet (too conservative dependence test). */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i];
a[i+1] = b[i] + c[i];
}
fbar (a);
}
|