Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/order-3.c

raw
1 void foo (void);
2 int v;
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 int omp_get_thread_num (void);
7 int omp_get_num_threads (void);
8 int omp_target_is_present (const void *, int);
9 int omp_get_cancellation (void);
10 #ifdef __cplusplus
11 }
12 #endif
13
14 void
15 f1 (int *a)
16 {
17 int i;
18 #pragma omp simd order(concurrent)
19 for (i = 0; i < 64; i++)
20 {
21 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
22 foo ();
23 }
24 #pragma omp simd order(concurrent)
25 for (i = 0; i < 64; i++)
26 {
27 int j;
28 #pragma omp simd
29 for (j = 0; j < 64; j++)
30 a[64 * i + j] = i + j;
31 }
32 #pragma omp simd order(concurrent)
33 for (i = 0; i < 64; i++)
34 {
35 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
36 foo ();
37 }
38 #pragma omp simd order(concurrent)
39 for (i = 0; i < 64; i++)
40 {
41 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
42 foo ();
43 }
44 #pragma omp simd order(concurrent)
45 for (i = 0; i < 64; i++)
46 {
47 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
48 v++;
49 }
50 #pragma omp simd order(concurrent)
51 for (i = 0; i < 64; i++)
52 {
53 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
54 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
55 }
56 #pragma omp simd order(concurrent)
57 for (i = 0; i < 64; i++)
58 {
59 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
60 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
61 }
62 #pragma omp simd order(concurrent)
63 for (i = 0; i < 64; i++)
64 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
65 #pragma omp simd order(concurrent)
66 for (i = 0; i < 64; i++)
67 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
68 #pragma omp simd order(concurrent)
69 for (i = 0; i < 64; i++)
70 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
71 #pragma omp simd order(concurrent)
72 for (i = 0; i < 64; i++)
73 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
74 }
75
76 void
77 f2 (int *a)
78 {
79 int i;
80 #pragma omp for simd order(concurrent)
81 for (i = 0; i < 64; i++)
82 {
83 #pragma omp parallel /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
84 foo ();
85 }
86 #pragma omp for simd order(concurrent)
87 for (i = 0; i < 64; i++)
88 {
89 int j;
90 #pragma omp simd
91 for (j = 0; j < 64; j++)
92 a[64 * i + j] = i + j;
93 }
94 #pragma omp for simd order(concurrent)
95 for (i = 0; i < 64; i++)
96 {
97 #pragma omp critical /* { dg-error "OpenMP constructs other than 'ordered simd', 'simd', 'loop' or 'atomic' may not be nested inside 'simd' region" } */
98 foo ();
99 }
100 #pragma omp for simd order(concurrent)
101 for (i = 0; i < 64; i++)
102 {
103 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
104 foo ();
105 }
106 #pragma omp for simd order(concurrent)
107 for (i = 0; i < 64; i++)
108 {
109 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
110 v++;
111 }
112 #pragma omp for simd order(concurrent)
113 for (i = 0; i < 64; i++)
114 {
115 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
116 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
117 }
118 #pragma omp for simd order(concurrent)
119 for (i = 0; i < 64; i++)
120 {
121 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
122 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
123 }
124 #pragma omp for simd order(concurrent)
125 for (i = 0; i < 64; i++)
126 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
127 #pragma omp for simd order(concurrent)
128 for (i = 0; i < 64; i++)
129 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
130 #pragma omp for simd order(concurrent)
131 for (i = 0; i < 64; i++)
132 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
133 #pragma omp for simd order(concurrent)
134 for (i = 0; i < 64; i++)
135 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
136 }
137
138 void
139 f3 (int *a)
140 {
141 int i;
142 #pragma omp for order(concurrent)
143 for (i = 0; i < 64; i++)
144 {
145 #pragma omp parallel
146 foo ();
147 }
148 #pragma omp for order(concurrent)
149 for (i = 0; i < 64; i++)
150 {
151 int j;
152 #pragma omp simd
153 for (j = 0; j < 64; j++)
154 a[64 * i + j] = i + j;
155 }
156 #pragma omp for order(concurrent)
157 for (i = 0; i < 64; i++)
158 {
159 #pragma omp critical /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
160 foo ();
161 }
162 #pragma omp for order(concurrent)
163 for (i = 0; i < 64; i++)
164 {
165 #pragma omp ordered simd /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
166 foo ();
167 }
168 #pragma omp for order(concurrent)
169 for (i = 0; i < 64; i++)
170 {
171 #pragma omp atomic /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
172 v++;
173 }
174 #pragma omp for order(concurrent)
175 for (i = 0; i < 64; i++)
176 {
177 #pragma omp atomic read /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
178 a[i] = v; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
179 }
180 #pragma omp for order(concurrent)
181 for (i = 0; i < 64; i++)
182 {
183 #pragma omp atomic write /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c++ } } */
184 v = a[i]; /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" "" { target c } } */
185 }
186 #pragma omp for order(concurrent)
187 for (i = 0; i < 64; i++)
188 {
189 #pragma omp task /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
190 a[i]++;
191 }
192 #pragma omp for order(concurrent)
193 for (i = 0; i < 64; i++)
194 {
195 int j;
196 #pragma omp taskloop /* { dg-error "OpenMP constructs other than 'parallel', 'loop' or 'simd' may not be nested inside a region with the 'order\\(concurrent\\)' clause" } */
197 for (j = 0; j < 64; j++)
198 a[64 * i + j] = i + j;
199 }
200 #pragma omp for order(concurrent)
201 for (i = 0; i < 64; i++)
202 a[i] += omp_get_thread_num (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_thread_num\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
203 #pragma omp for order(concurrent)
204 for (i = 0; i < 64; i++)
205 a[i] += omp_get_num_threads (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_threads\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
206 #pragma omp for order(concurrent)
207 for (i = 0; i < 64; i++)
208 a[i] += omp_target_is_present (a + i, 0); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_target_is_present\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
209 #pragma omp for order(concurrent)
210 for (i = 0; i < 64; i++)
211 a[i] += omp_get_cancellation (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_cancellation\[^\n\r]*' in a region with 'order\\(concurrent\\)' clause" } */
212 }