1 // RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
2 // RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
3 // RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
4 // RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
5 // RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
7 // REQUIRES: unified_shared_memory
8 // UNSUPPORTED: amdgcn-amd-amdhsa
10 #pragma omp declare target
12 #pragma omp end declare target
18 ptr1
= (int *)malloc(sizeof(int) * 100);
20 ptr2
= (int *)malloc(sizeof(int) * 100);
21 #pragma omp target map(ptr1, ptr1[ : 100])
24 printf(" %d \n", ptr1
[1]);
25 #pragma omp target data map(ptr1[ : 5])
27 #pragma omp target map(ptr1[2], ptr1, ptr1[3]) map(ptr2, ptr2[2])
35 printf(" %d %d %d \n", ptr2
[2], ptr1
[2], ptr1
[3]);
37 #pragma omp target map(ptr2, ptr2[ : 100])
40 printf(" %d \n", ptr2
[1]);
46 printf("%d %p %p\n", p
[1], p
, &p
); // 111 hst_p1 hst_p2
47 #pragma omp target data map(to : p[1 : 3]) map(p)
48 #pragma omp target data use_device_addr(p)
50 #pragma omp target has_device_addr(p)
53 printf("%d %p %p\n", p
[1], p
, &p
); // 111 dev_p1 dev_p2
56 printf("%d %p %p\n", p
[1], p
, &p
); // 222 dev_p1 dev_p2
60 printf("%d %p %p\n", p
[1], p
, &p
); // 111 hst_p1 hst_p2