OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c/] [loop-11.c] - Blame information for rev 280

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 273 jeremybenn
#include <omp.h>
2
#include <stdlib.h>
3
#include <string.h>
4
 
5
int
6
test1 (void)
7
{
8
  short int buf[64], *p;
9
  int i;
10
  memset (buf, '\0', sizeof (buf));
11
#pragma omp parallel for
12
  for (p = &buf[10]; &buf[54] > p; p++)
13
    *p = 5;
14
  for (i = 0; i < 64; i++)
15
    if (buf[i] != 5 * (i >= 10 && i < 54))
16
      abort ();
17
  memset (buf, '\0', sizeof (buf));
18
#pragma omp parallel for
19
  for (p = &buf[3]; &buf[63] >= p; p += 2)
20
    p[-2] = 6;
21
  for (i = 0; i < 64; i++)
22
    if (buf[i] != 6 * ((i & 1) && i <= 61))
23
      abort ();
24
  memset (buf, '\0', sizeof (buf));
25
#pragma omp parallel for
26
  for (p = &buf[16]; &buf[51] > p; p = 4 + p)
27
    p[2] = 7;
28
  for (i = 0; i < 64; i++)
29
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
30
      abort ();
31
  memset (buf, '\0', sizeof (buf));
32
#pragma omp parallel for
33
  for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
34
    p[2] = -7;
35
  for (i = 0; i < 64; i++)
36
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
37
      abort ();
38
  memset (buf, '\0', sizeof (buf));
39
#pragma omp parallel for
40
  for (p = &buf[53]; &buf[9] < p; --p)
41
    *p = 5;
42
  for (i = 0; i < 64; i++)
43
    if (buf[i] != 5 * (i >= 10 && i < 54))
44
      abort ();
45
  memset (buf, '\0', sizeof (buf));
46
#pragma omp parallel for
47
  for (p = &buf[63]; &buf[3] <= p; p -= 2)
48
    p[-2] = 6;
49
  for (i = 0; i < 64; i++)
50
    if (buf[i] != 6 * ((i & 1) && i <= 61))
51
      abort ();
52
  memset (buf, '\0', sizeof (buf));
53
#pragma omp parallel for
54
  for (p = &buf[48]; &buf[15] < p; p = -4 + p)
55
    p[2] = 7;
56
  for (i = 0; i < 64; i++)
57
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
58
      abort ();
59
  memset (buf, '\0', sizeof (buf));
60
#pragma omp parallel for
61
  for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
62
    p[2] = -7;
63
  for (i = 0; i < 64; i++)
64
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
65
      abort ();
66
  return 0;
67
}
68
 
69
int
70
test2 (void)
71
{
72
  int buf[64], *p;
73
  int i;
74
  memset (buf, '\0', sizeof (buf));
75
#pragma omp parallel for schedule (static, 3)
76
  for (p = &buf[10]; &buf[54] > p; p++)
77
    *p = 5;
78
  for (i = 0; i < 64; i++)
79
    if (buf[i] != 5 * (i >= 10 && i < 54))
80
      abort ();
81
  memset (buf, '\0', sizeof (buf));
82
#pragma omp parallel for schedule (static, 3)
83
  for (p = &buf[3]; &buf[63] >= p; p += 2)
84
    p[-2] = 6;
85
  for (i = 0; i < 64; i++)
86
    if (buf[i] != 6 * ((i & 1) && i <= 61))
87
      abort ();
88
  memset (buf, '\0', sizeof (buf));
89
#pragma omp parallel for schedule (static, 3)
90
  for (p = &buf[16]; &buf[51] > p; p = 4 + p)
91
    p[2] = 7;
92
  for (i = 0; i < 64; i++)
93
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
94
      abort ();
95
  memset (buf, '\0', sizeof (buf));
96
#pragma omp parallel for schedule (static, 3)
97
  for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
98
    p[2] = -7;
99
  for (i = 0; i < 64; i++)
100
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
101
      abort ();
102
  memset (buf, '\0', sizeof (buf));
103
#pragma omp parallel for schedule (static, 3)
104
  for (p = &buf[53]; &buf[9] < p; --p)
105
    *p = 5;
106
  for (i = 0; i < 64; i++)
107
    if (buf[i] != 5 * (i >= 10 && i < 54))
108
      abort ();
109
  memset (buf, '\0', sizeof (buf));
110
#pragma omp parallel for schedule (static, 3)
111
  for (p = &buf[63]; &buf[3] <= p; p -= 2)
112
    p[-2] = 6;
113
  for (i = 0; i < 64; i++)
114
    if (buf[i] != 6 * ((i & 1) && i <= 61))
115
      abort ();
116
  memset (buf, '\0', sizeof (buf));
117
#pragma omp parallel for schedule (static, 3)
118
  for (p = &buf[48]; &buf[15] < p; p = -4 + p)
119
    p[2] = 7;
120
  for (i = 0; i < 64; i++)
121
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
122
      abort ();
123
  memset (buf, '\0', sizeof (buf));
124
#pragma omp parallel for schedule (static, 3)
125
  for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
126
    p[2] = -7;
127
  for (i = 0; i < 64; i++)
128
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
129
      abort ();
130
  return 0;
131
}
132
 
133
int
134
test3 (void)
135
{
136
  int buf[64], *p;
137
  int i;
138
  memset (buf, '\0', sizeof (buf));
139
#pragma omp parallel for schedule (dynamic, 3)
140
  for (p = &buf[10]; &buf[54] > p; p++)
141
    *p = 5;
142
  for (i = 0; i < 64; i++)
143
    if (buf[i] != 5 * (i >= 10 && i < 54))
144
      abort ();
145
  memset (buf, '\0', sizeof (buf));
146
#pragma omp parallel for schedule (dynamic, 3)
147
  for (p = &buf[3]; &buf[63] >= p; p += 2)
148
    p[-2] = 6;
149
  for (i = 0; i < 64; i++)
150
    if (buf[i] != 6 * ((i & 1) && i <= 61))
151
      abort ();
152
  memset (buf, '\0', sizeof (buf));
153
#pragma omp parallel for schedule (dynamic, 3)
154
  for (p = &buf[16]; &buf[51] > p; p = 4 + p)
155
    p[2] = 7;
156
  for (i = 0; i < 64; i++)
157
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
158
      abort ();
159
  memset (buf, '\0', sizeof (buf));
160
#pragma omp parallel for schedule (dynamic, 3)
161
  for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
162
    p[2] = -7;
163
  for (i = 0; i < 64; i++)
164
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
165
      abort ();
166
  memset (buf, '\0', sizeof (buf));
167
#pragma omp parallel for schedule (dynamic, 3)
168
  for (p = &buf[53]; &buf[9] < p; --p)
169
    *p = 5;
170
  for (i = 0; i < 64; i++)
171
    if (buf[i] != 5 * (i >= 10 && i < 54))
172
      abort ();
173
  memset (buf, '\0', sizeof (buf));
174
#pragma omp parallel for schedule (dynamic, 3)
175
  for (p = &buf[63]; &buf[3] <= p; p -= 2)
176
    p[-2] = 6;
177
  for (i = 0; i < 64; i++)
178
    if (buf[i] != 6 * ((i & 1) && i <= 61))
179
      abort ();
180
  memset (buf, '\0', sizeof (buf));
181
#pragma omp parallel for schedule (dynamic, 3)
182
  for (p = &buf[48]; &buf[15] < p; p = -4 + p)
183
    p[2] = 7;
184
  for (i = 0; i < 64; i++)
185
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
186
      abort ();
187
  memset (buf, '\0', sizeof (buf));
188
#pragma omp parallel for schedule (dynamic, 3)
189
  for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
190
    p[2] = -7;
191
  for (i = 0; i < 64; i++)
192
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
193
      abort ();
194
  return 0;
195
}
196
 
197
int
198
test4 (void)
199
{
200
  int buf[64], *p;
201
  int i;
202
  memset (buf, '\0', sizeof (buf));
203
#pragma omp parallel for schedule (runtime)
204
  for (p = &buf[10]; &buf[54] > p; p++)
205
    *p = 5;
206
  for (i = 0; i < 64; i++)
207
    if (buf[i] != 5 * (i >= 10 && i < 54))
208
      abort ();
209
  memset (buf, '\0', sizeof (buf));
210
#pragma omp parallel for schedule (runtime)
211
  for (p = &buf[3]; &buf[63] >= p; p += 2)
212
    p[-2] = 6;
213
  for (i = 0; i < 64; i++)
214
    if (buf[i] != 6 * ((i & 1) && i <= 61))
215
      abort ();
216
  memset (buf, '\0', sizeof (buf));
217
#pragma omp parallel for schedule (runtime)
218
  for (p = &buf[16]; &buf[51] > p; p = 4 + p)
219
    p[2] = 7;
220
  for (i = 0; i < 64; i++)
221
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
222
      abort ();
223
  memset (buf, '\0', sizeof (buf));
224
#pragma omp parallel for schedule (runtime)
225
  for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
226
    p[2] = -7;
227
  for (i = 0; i < 64; i++)
228
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
229
      abort ();
230
  memset (buf, '\0', sizeof (buf));
231
#pragma omp parallel for schedule (runtime)
232
  for (p = &buf[53]; &buf[9] < p; --p)
233
    *p = 5;
234
  for (i = 0; i < 64; i++)
235
    if (buf[i] != 5 * (i >= 10 && i < 54))
236
      abort ();
237
  memset (buf, '\0', sizeof (buf));
238
#pragma omp parallel for schedule (runtime)
239
  for (p = &buf[63]; &buf[3] <= p; p -= 2)
240
    p[-2] = 6;
241
  for (i = 0; i < 64; i++)
242
    if (buf[i] != 6 * ((i & 1) && i <= 61))
243
      abort ();
244
  memset (buf, '\0', sizeof (buf));
245
#pragma omp parallel for schedule (runtime)
246
  for (p = &buf[48]; &buf[15] < p; p = -4 + p)
247
    p[2] = 7;
248
  for (i = 0; i < 64; i++)
249
    if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
250
      abort ();
251
  memset (buf, '\0', sizeof (buf));
252
#pragma omp parallel for schedule (runtime)
253
  for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
254
    p[2] = -7;
255
  for (i = 0; i < 64; i++)
256
    if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
257
      abort ();
258
  return 0;
259
}
260
 
261
int
262
main (void)
263
{
264
  test1 ();
265
  test2 ();
266
  test3 ();
267
  omp_set_schedule (omp_sched_static, 0);
268
  test4 ();
269
  omp_set_schedule (omp_sched_static, 3);
270
  test4 ();
271
  omp_set_schedule (omp_sched_dynamic, 5);
272
  test4 ();
273
  omp_set_schedule (omp_sched_guided, 2);
274
  test4 ();
275
  return 0;
276
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.