summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/examples-4/e.57.1.c')
-rw-r--r--libgomp/testsuite/libgomp.c/examples-4/e.57.1.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c b/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
new file mode 100644
index 00000000000..f7c84fb4c14
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/examples-4/e.57.1.c
@@ -0,0 +1,59 @@
+/* { dg-do run } */
+/* { dg-require-effective-target offload_device } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int main ()
+{
+ int a = 100;
+ int b = 0;
+ int c, d;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 100 || !c || d)
+ abort ();
+
+ a += 200;
+ b = 0;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 0 || c || d)
+ abort ();
+
+ a += 200;
+ b = 0;
+
+ #pragma omp target if(a > 200 && a < 400)
+ c = omp_is_initial_device ();
+
+ #pragma omp target data map(to: b) if(a > 200 && a < 400)
+ #pragma omp target
+ {
+ b = 100;
+ d = omp_is_initial_device ();
+ }
+
+ if (b != 100 || !c || d)
+ abort ();
+
+ return 0;
+}