Skip various cmp-mem-const tests on lp64 hppa*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / target-has-device-addr-1.c
blobfcc5c9e85534fb9d26b70c434acd52827c202529
1 /* Testing the 'has_device_addr' clause on the target construct with
2 enclosing 'target data' construct. */
4 #define N 40
6 int
7 main ()
9 int x = 24;
11 #pragma omp target data map(x) use_device_addr(x)
12 #pragma omp target has_device_addr(x)
13 x = 42;
14 if (x != 42)
15 __builtin_abort ();
17 int y[N];
19 for (int i = 0; i < N; i++)
20 y[i] = 42;
21 #pragma omp target data map(y) use_device_addr(y)
22 #pragma omp target has_device_addr(y)
23 for (int i = 0; i < N; i++)
24 y[i] = i;
25 for (int i = 0; i < N; i++)
26 if (y[i] != i)
27 __builtin_abort ();
29 #pragma omp target data map(y[:N]) use_device_addr(y)
30 #pragma omp target has_device_addr(y[:N])
31 for (int i = 0; i < N; i++)
32 y[i] = i + 2;
33 for (int i = 0; i < N; i++)
34 if (y[i] != i + 2)
35 __builtin_abort ();
37 #pragma omp target data map(y[:N]) use_device_addr(y)
38 #pragma omp target has_device_addr(y[24])
39 y[24] = 42;
40 if (y[24] != 42)
41 __builtin_abort ();
43 #pragma omp target data map(y[:N]) use_device_addr(y)
44 #pragma omp target has_device_addr(y[24:])
45 for (int i = 24; i < N; i++)
46 y[i] = i + 3;
47 for (int i = 24; i < N; i++)
48 if (y[i] != i + 3)
49 __builtin_abort ();
51 #pragma omp target data map(y[:N]) use_device_addr(y)
52 #pragma omp target has_device_addr(y[12:24])
53 for (int i = 12; i < 24; i++)
54 y[i] = i + 4;
55 for (int i = 12; i < 24; i++)
56 if (y[i] != i + 4)
57 __builtin_abort ();
59 int u[0];
60 #pragma omp target data map(u) use_device_addr(u)
61 #pragma omp target has_device_addr(u)
64 struct S { int m; } s;
65 s.m = 42;
66 #pragma omp target data map (s) use_device_addr (s)
67 #pragma omp target has_device_addr (s)
68 ++s.m;
69 if (s.m != 43)
70 __builtin_abort ();
72 return 0;