Improve atomic store implementation on hppa-linux.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / enter_exit-lib.c
blobf86af75beaa05aa7dd95f9566255ff6e6f274411
1 /* Verify enter/exit data interoperability between pragmas and
2 acc library calls. */
4 /* { dg-do run } */
6 #include <stdlib.h>
7 #include <assert.h>
8 #include <openacc.h>
10 int
11 main ()
13 int *p = (int *)malloc (sizeof (int));
15 /* Test 1: pragma input, library output. */
17 #pragma acc enter data copyin (p[0:1])
19 #pragma acc parallel present (p[0:1]) num_gangs (1)
21 p[0] = 1;
24 acc_copyout (p, sizeof (int));
26 assert (p[0] == 1);
28 /* Test 2: library input, pragma output. */
30 acc_copyin (p, sizeof (int));
32 #pragma acc parallel present (p[0:1]) num_gangs (1)
34 p[0] = 2;
37 #pragma acc exit data copyout (p[0:1])
39 assert (p[0] == 2);
41 /* Test 3: library input, library output. */
43 acc_copyin (p, sizeof (int));
45 #pragma acc parallel present (p[0:1]) num_gangs (1)
47 p[0] = 3;
50 acc_copyout (p, sizeof (int));
52 assert (p[0] == 3);
54 /* Test 4: pragma input, pragma output. */
56 #pragma acc enter data copyin (p[0:1])
58 #pragma acc parallel present (p[0:1]) num_gangs (1)
60 p[0] = 3;
63 #pragma acc exit data copyout (p[0:1])
65 assert (p[0] == 3);
67 free (p);
69 return 0;