Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / runtime / test / api / omp_in_explicit_task.c
blob6ecdba18cf86f8067291e4a9cbb5dc475fd70a43
1 // RUN: %libomp-compile-and-run
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <omp.h>
7 int main()
9 int res;
10 res = omp_in_explicit_task();
11 if (res) {
12 printf("error: omp_in_explicit_task: serial1 returned %d\n", res);
13 return 1;
15 #pragma omp parallel num_threads(2)
17 int r = omp_in_explicit_task();
18 if (r) {
19 printf("error: omp_in_explicit_task: par #%d returned %d\n",
20 omp_get_thread_num(), r);
21 exit(1);
23 #pragma omp task
25 int r = omp_in_explicit_task();
26 if (!r) {
27 printf("error: omp_in_explicit_task: task1 #%d returned %d\n",
28 omp_get_thread_num(), r);
29 exit(1);
32 #pragma omp task
34 int r = omp_in_explicit_task();
35 if (!r) {
36 printf("error: omp_in_explicit_task: task2 #%d returned %d\n",
37 omp_get_thread_num(), r);
38 exit(1);
42 res = omp_in_explicit_task();
43 if (res) {
44 printf("error: omp_in_explicit_task: serial2 returned %d\n", res);
45 return 1;
47 printf("passed\n");
48 return 0;