1 // --------------------------------------------------
2 // Check 'to'
3 // --------------------------------------------------
4 
5 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
6 // RUN:   -fopenmp-version=51 -DCLAUSE=to
7 // RUN: %libomptarget-run-fail-aarch64-unknown-linux-gnu 2>&1 \
8 // RUN: | %fcheck-aarch64-unknown-linux-gnu
9 
10 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
11 // RUN:   -fopenmp-version=51 -DCLAUSE=to
12 // RUN: %libomptarget-run-fail-powerpc64-ibm-linux-gnu 2>&1 \
13 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
14 
15 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
16 // RUN:   -fopenmp-version=51 -DCLAUSE=to
17 // RUN: %libomptarget-run-fail-powerpc64le-ibm-linux-gnu 2>&1 \
18 // RUN: | %fcheck-powerpc64le-ibm-linux-gnu
19 
20 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu \
21 // RUN:   -fopenmp-version=51 -DCLAUSE=to
22 // RUN: %libomptarget-run-fail-x86_64-pc-linux-gnu 2>&1 \
23 // RUN: | %fcheck-x86_64-pc-linux-gnu
24 
25 // --------------------------------------------------
26 // Check 'from'
27 // --------------------------------------------------
28 
29 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
30 // RUN:   -fopenmp-version=51 -DCLAUSE=from
31 // RUN: %libomptarget-run-fail-aarch64-unknown-linux-gnu 2>&1 \
32 // RUN: | %fcheck-aarch64-unknown-linux-gnu
33 
34 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
35 // RUN:   -fopenmp-version=51 -DCLAUSE=from
36 // RUN: %libomptarget-run-fail-powerpc64-ibm-linux-gnu 2>&1 \
37 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
38 
39 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
40 // RUN:   -fopenmp-version=51 -DCLAUSE=from
41 // RUN: %libomptarget-run-fail-powerpc64le-ibm-linux-gnu 2>&1 \
42 // RUN: | %fcheck-powerpc64le-ibm-linux-gnu
43 
44 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu \
45 // RUN:   -fopenmp-version=51 -DCLAUSE=from
46 // RUN: %libomptarget-run-fail-x86_64-pc-linux-gnu 2>&1 \
47 // RUN: | %fcheck-x86_64-pc-linux-gnu
48 
49 #include <stdio.h>
50 
main()51 int main() {
52   int i;
53 
54   // CHECK: addr=0x[[#%x,HOST_ADDR:]], size=[[#%u,SIZE:]]
55   fprintf(stderr, "addr=%p, size=%ld\n", &i, sizeof i);
56 
57   // CHECK-NOT: Libomptarget
58 #pragma omp target enter data map(alloc: i)
59 #pragma omp target update CLAUSE(present: i)
60 #pragma omp target exit data map(delete: i)
61 
62   // CHECK: i is present
63   fprintf(stderr, "i is present\n");
64 
65   // CHECK: Libomptarget message: device mapping required by 'present' motion modifier does not exist for host address 0x{{0*}}[[#HOST_ADDR]] ([[#SIZE]] bytes)
66   // CHECK: Libomptarget fatal error 1: failure of target construct while offloading is mandatory
67 #pragma omp target update CLAUSE(present: i)
68 
69   // CHECK-NOT: i is present
70   fprintf(stderr, "i is present\n");
71 
72   return 0;
73 }
74