summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/ordered-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/ordered-3.c')
-rw-r--r--libgomp/testsuite/libgomp.c/ordered-3.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/ordered-3.c b/libgomp/testsuite/libgomp.c/ordered-3.c
new file mode 100644
index 000000000..2a2f21970
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/ordered-3.c
@@ -0,0 +1,82 @@
+#include <stdlib.h>
+
+int cnt;
+
+void
+check (int x)
+{
+ if (cnt++ != x)
+ abort ();
+}
+
+int
+main (void)
+{
+ int j;
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (guided) num_threads (4) if (0)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ cnt = 0;
+#pragma omp parallel for ordered schedule (guided) num_threads (4) if (1)
+ for (j = 0; j < 1000; j++)
+ {
+#pragma omp ordered
+ check (j);
+ }
+
+ return 0;
+}