xref: /llvm-project/offload/test/mapping/present/unified_shared_memory.c (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 // RUN: %libomptarget-compile-generic
2 // RUN: %libomptarget-run-generic 2>&1 \
3 // RUN: | %fcheck-generic
4 
5 // REQUIRES: unified_shared_memory
6 
7 #include <stdio.h>
8 
9 // The runtime considers unified shared memory to be always present.
10 #pragma omp requires unified_shared_memory
11 
main()12 int main() {
13   int i;
14 
15   // CHECK-NOT: omptarget
16 #pragma omp target data map(alloc : i)
17 #pragma omp target map(present, alloc : i)
18   ;
19 
20   // CHECK: i is present
21   fprintf(stderr, "i is present\n");
22 
23   // CHECK-NOT: omptarget
24 #pragma omp target map(present, alloc : i)
25   ;
26 
27   // CHECK: is present
28   fprintf(stderr, "i is present\n");
29 
30   return 0;
31 }
32