1 // RUN: %libomptarget-compile-generic -fopenmp-extensions
2 // RUN: %libomptarget-run-generic | %fcheck-generic -strict-whitespace
7 #define CHECK_PRESENCE(Var1, Var2, Var3) \
8 printf(" presence of %s, %s, %s: %d, %d, %d\n", #Var1, #Var2, #Var3, \
9 omp_target_is_present(&Var1, omp_get_default_device()), \
10 omp_target_is_present(&Var2, omp_get_default_device()), \
11 omp_target_is_present(&Var3, omp_get_default_device()))
15 // CHECK: presence of m, r, d: 0, 0, 0
16 CHECK_PRESENCE(m
, r
, d
);
18 // -----------------------------------------------------------------------
19 // CHECK-NEXT: check:{{.*}}
20 printf("check: dyn>0, hold=0, dec dyn=0\n");
24 #pragma omp target map(tofrom : m) map(alloc : r, d)
26 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
27 CHECK_PRESENCE(m
, r
, d
);
31 #pragma omp target data map(tofrom : m) map(alloc : r, d)
33 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
34 CHECK_PRESENCE(m
, r
, d
);
35 #pragma omp target map(tofrom : m) map(alloc : r, d)
37 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
38 CHECK_PRESENCE(m
, r
, d
);
40 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
41 CHECK_PRESENCE(m
, r
, d
);
43 // -----------------------------------------------------------------------
44 // CHECK: check:{{.*}}
45 printf("check: dyn=0, hold>0, dec hold=0\n");
49 #pragma omp target map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
51 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
52 CHECK_PRESENCE(m
, r
, d
);
56 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
58 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
59 CHECK_PRESENCE(m
, r
, d
);
60 #pragma omp target map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
62 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
63 CHECK_PRESENCE(m
, r
, d
);
65 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
66 CHECK_PRESENCE(m
, r
, d
);
68 // -----------------------------------------------------------------------
69 // CHECK: check:{{.*}}
70 printf("check: dyn>0, hold>0, dec dyn=0, dec hold=0\n");
72 // CHECK-NEXT: once each
73 printf(" once each\n");
74 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
76 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
77 CHECK_PRESENCE(m
, r
, d
);
78 #pragma omp target map(tofrom : m) map(alloc : r, d)
80 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
81 CHECK_PRESENCE(m
, r
, d
);
83 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
84 CHECK_PRESENCE(m
, r
, d
);
86 // CHECK-NEXT: twice each
87 printf(" twice each\n");
88 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
90 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
91 CHECK_PRESENCE(m
, r
, d
);
92 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
94 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
95 CHECK_PRESENCE(m
, r
, d
);
96 #pragma omp target data map(tofrom : m) map(alloc : r, d)
98 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
99 CHECK_PRESENCE(m
, r
, d
);
100 #pragma omp target map(tofrom : m) map(alloc : r, d)
102 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
103 CHECK_PRESENCE(m
, r
, d
);
105 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
106 CHECK_PRESENCE(m
, r
, d
);
108 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
109 CHECK_PRESENCE(m
, r
, d
);
111 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
112 CHECK_PRESENCE(m
, r
, d
);
114 // -----------------------------------------------------------------------
115 // CHECK: check:{{.*}}
116 printf("check: dyn>0, hold>0, dec hold=0, dec dyn=0\n");
118 // CHECK-NEXT: once each
119 printf(" once each\n");
120 #pragma omp target data map(tofrom : m) map(alloc : r, d)
122 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
123 CHECK_PRESENCE(m
, r
, d
);
124 #pragma omp target map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
126 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
127 CHECK_PRESENCE(m
, r
, d
);
129 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
130 CHECK_PRESENCE(m
, r
, d
);
132 // CHECK-NEXT: twice each
133 printf(" twice each\n");
134 #pragma omp target data map(tofrom : m) map(alloc : r, d)
136 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
137 CHECK_PRESENCE(m
, r
, d
);
138 #pragma omp target data map(tofrom : m) map(alloc : r, d)
140 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
141 CHECK_PRESENCE(m
, r
, d
);
142 #pragma omp target data map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
144 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
145 CHECK_PRESENCE(m
, r
, d
);
146 #pragma omp target map(ompx_hold, tofrom : m) map(ompx_hold, alloc : r, d)
148 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
149 CHECK_PRESENCE(m
, r
, d
);
151 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
152 CHECK_PRESENCE(m
, r
, d
);
154 // CHECK-NEXT: presence of m, r, d: 1, 1, 1
155 CHECK_PRESENCE(m
, r
, d
);
157 // CHECK-NEXT: presence of m, r, d: 0, 0, 0
158 CHECK_PRESENCE(m
, r
, d
);