Remove xfail for hppa*-*-hpux* from stdatomic-flag.c and stdatomic-flag-2.c
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c++ / non-scalar-data.C
blobe5f8707c24911fa9b48a6ba1dfd86bc50f81b561
1 // Ensure that a non-scalar dummy arguments which are implicitly used inside
2 // offloaded regions are properly mapped using present_or_copy semantics.
4 // { dg-do run }
6 #include <cassert>
8 const int n = 100;
10 struct data {
11   int v;
14 void
15 kernels_present (data &d, int &x)
17 #pragma acc kernels present (d, x) default (none)
18   {
19     d.v = x;
20   }
23 void
24 parallel_present (data &d, int &x)
26 #pragma acc parallel present (d, x) default (none)
27   {
28     d.v = x;
29   }
32 void
33 kernels_implicit (data &d, int &x)
35 #pragma acc kernels
36   {
37     d.v = x;
38   }
41 void
42 parallel_implicit (data &d, int &x)
44 #pragma acc parallel
45   {
46     d.v = x;
47   }
50 void
51 reference_data (data &d, int &x)
53 #pragma acc data copy(d, x)
54   {
55     kernels_present (d, x);
57 #pragma acc update host(d)
58     assert (d.v == x);
60     x = 200;
61 #pragma acc update device(x)
62     
63     parallel_present (d, x);
64   }
66   assert (d.v == x);
68   x = 300;
69   kernels_implicit (d, x);
70   assert (d.v == x);
72   x = 400;
73   parallel_implicit (d, x);
74   assert (d.v == x);
77 int
78 main ()
80   data d;
81   int x = 100;
83 #pragma acc data copy(d, x)
84   {
85     kernels_present (d, x);
87 #pragma acc update host(d)
88     assert (d.v == x);
90     x = 200;
91 #pragma acc update device(x)
92     
93     parallel_present (d, x);
94   }
96   assert (d.v == x);
98   x = 300;
99   kernels_implicit (d, x);
100   assert (d.v == x);
102   x = 400;
103   parallel_implicit (d, x);
104   assert (d.v == x);
106   reference_data (d, x);
108   return 0;