1 int a[256];
2
3 __attribute__((noinline, noclone)) int
f1(int i)4 f1 (int i)
5 {
6 #pragma omp parallel for linear (i: 4)
7 for (int j = 16; j < 64; j++)
8 {
9 a[i] = j;
10 i += 4;
11 }
12 return i;
13 }
14
15 __attribute__((noinline, noclone)) short int
f2(short int i,char k)16 f2 (short int i, char k)
17 {
18 #pragma omp parallel for linear (i: k + 1)
19 for (long j = 16; j < 64; j++)
20 {
21 a[i] = j;
22 i += 4;
23 }
24 return i;
25 }
26
27 __attribute__((noinline, noclone)) long long int
f3(long long int i,long long int k)28 f3 (long long int i, long long int k)
29 {
30 #pragma omp parallel for linear (i: k)
31 for (short j = 16; j < 64; j++)
32 {
33 a[i] = j;
34 i += 4;
35 }
36 return i;
37 }
38
39 __attribute__((noinline, noclone)) int
f4(int i)40 f4 (int i)
41 {
42 #pragma omp parallel for linear (i: 4) schedule(static, 3)
43 for (int j = 16; j < 64; j++)
44 {
45 a[i] = j;
46 i += 4;
47 }
48 return i;
49 }
50
51 __attribute__((noinline, noclone)) short int
f5(short int i,char k)52 f5 (short int i, char k)
53 {
54 #pragma omp parallel for linear (i: k + 1) schedule(static, 5)
55 for (long j = 16; j < 64; j++)
56 {
57 a[i] = j;
58 i += 4;
59 }
60 return i;
61 }
62
63 __attribute__((noinline, noclone)) long long int
f6(long long int i,long long int k)64 f6 (long long int i, long long int k)
65 {
66 #pragma omp parallel for linear (i: k) schedule(static, 7)
67 for (short j = 16; j < 64; j++)
68 {
69 a[i] = j;
70 i += 4;
71 }
72 return i;
73 }
74
75 __attribute__((noinline, noclone)) int
f7(int i)76 f7 (int i)
77 {
78 #pragma omp parallel for linear (i: 4) schedule(dynamic, 3)
79 for (int j = 16; j < 64; j++)
80 {
81 a[i] = j;
82 i += 4;
83 }
84 return i;
85 }
86
87 __attribute__((noinline, noclone)) short int
f8(short int i,char k)88 f8 (short int i, char k)
89 {
90 #pragma omp parallel for linear (i: k + 1) schedule(dynamic, 5)
91 for (long j = 16; j < 64; j++)
92 {
93 a[i] = j;
94 i += 4;
95 }
96 return i;
97 }
98
99 __attribute__((noinline, noclone)) long long int
f9(long long int i,long long int k)100 f9 (long long int i, long long int k)
101 {
102 #pragma omp parallel for linear (i: k) schedule(dynamic, 7)
103 for (short j = 16; j < 64; j++)
104 {
105 a[i] = j;
106 i += 4;
107 }
108 return i;
109 }
110
111 __attribute__((noinline, noclone)) int
f10(int i,long step)112 f10 (int i, long step)
113 {
114 #pragma omp parallel for linear (i: 4)
115 for (int j = 16; j < 112; j += step)
116 {
117 a[i] = j / 2 + 8;
118 i += 4;
119 }
120 return i;
121 }
122
123 __attribute__((noinline, noclone)) short int
f11(short int i,char k,char step)124 f11 (short int i, char k, char step)
125 {
126 #pragma omp parallel for linear (i: k + 1)
127 for (long j = 16; j < 112; j += step)
128 {
129 a[i] = j / 2 + 8;
130 i += 4;
131 }
132 return i;
133 }
134
135 __attribute__((noinline, noclone)) long long int
f12(long long int i,long long int k,int step)136 f12 (long long int i, long long int k, int step)
137 {
138 #pragma omp parallel for linear (i: k)
139 for (short j = 16; j < 112; j += step)
140 {
141 a[i] = j / 2 + 8;
142 i += 4;
143 }
144 return i;
145 }
146
147 __attribute__((noinline, noclone)) int
f13(int i,long long int step)148 f13 (int i, long long int step)
149 {
150 #pragma omp parallel for linear (i: 4) schedule(static, 3)
151 for (int j = 16; j < 112; j += step)
152 {
153 a[i] = j / 2 + 8;
154 i += 4;
155 }
156 return i;
157 }
158
159 __attribute__((noinline, noclone)) short int
f14(short int i,char k,int step)160 f14 (short int i, char k, int step)
161 {
162 #pragma omp parallel for linear (i: k + 1) schedule(static, 5)
163 for (long j = 16; j < 112; j += step)
164 {
165 a[i] = j / 2 + 8;
166 i += 4;
167 }
168 return i;
169 }
170
171 __attribute__((noinline, noclone)) long long int
f15(long long int i,long long int k,long int step)172 f15 (long long int i, long long int k, long int step)
173 {
174 #pragma omp parallel for linear (i: k) schedule(static, 7)
175 for (short j = 16; j < 112; j += step)
176 {
177 a[i] = j / 2 + 8;
178 i += 4;
179 }
180 return i;
181 }
182
183 __attribute__((noinline, noclone)) int
f16(int i,long long int step)184 f16 (int i, long long int step)
185 {
186 #pragma omp parallel for linear (i: 4) schedule(dynamic, 3)
187 for (int j = 16; j < 112; j += step)
188 {
189 a[i] = j / 2 + 8;
190 i += 4;
191 }
192 return i;
193 }
194
195 __attribute__((noinline, noclone)) short int
f17(short int i,char k,int step)196 f17 (short int i, char k, int step)
197 {
198 #pragma omp parallel for linear (i: k + 1) schedule(dynamic, 5)
199 for (long j = 16; j < 112; j += step)
200 {
201 a[i] = j / 2 + 8;
202 i += 4;
203 }
204 return i;
205 }
206
207 __attribute__((noinline, noclone)) long long int
f18(long long int i,long long int k,long int step)208 f18 (long long int i, long long int k, long int step)
209 {
210 #pragma omp parallel for linear (i: k) schedule(dynamic, 7)
211 for (short j = 16; j < 112; j += step)
212 {
213 a[i] = j / 2 + 8;
214 i += 4;
215 }
216 return i;
217 }
218
219 int
main()220 main ()
221 {
222 #define TEST(x) \
223 if (x != 8 + 48 * 4) \
224 __builtin_abort (); \
225 for (int i = 0; i < 256; i++) \
226 if (a[i] != (((i & 3) == 0 && i >= 8 \
227 && i < 8 + 48 * 4) \
228 ? ((i - 8) / 4) + 16 : 0)) \
229 __builtin_abort (); \
230 __builtin_memset (a, 0, sizeof (a))
231 TEST (f1 (8));
232 TEST (f2 (8, 3));
233 TEST (f3 (8LL, 4LL));
234 TEST (f4 (8));
235 TEST (f5 (8, 3));
236 TEST (f6 (8LL, 4LL));
237 TEST (f7 (8));
238 TEST (f8 (8, 3));
239 TEST (f9 (8LL, 4LL));
240 TEST (f10 (8, 2));
241 TEST (f11 (8, 3, 2));
242 TEST (f12 (8LL, 4LL, 2));
243 TEST (f13 (8, 2));
244 TEST (f14 (8, 3, 2));
245 TEST (f15 (8LL, 4LL, 2));
246 TEST (f16 (8, 2));
247 TEST (f17 (8, 3, 2));
248 TEST (f18 (8LL, 4LL, 2));
249 return 0;
250 }
251