1 // --------------------------------------------------
2 // Check 'to' and extends before
3 // --------------------------------------------------
4
5 // RUN: %libomptarget-compile-generic \
6 // RUN: -DCLAUSE=to -DEXTENDS=BEFORE
7 // RUN: %libomptarget-run-generic 2>&1 \
8 // RUN: | %fcheck-generic
9
10 // --------------------------------------------------
11 // Check 'from' and extends before
12 // --------------------------------------------------
13
14 // RUN: %libomptarget-compile-generic \
15 // RUN: -DCLAUSE=from -DEXTENDS=BEFORE
16 // RUN: %libomptarget-run-generic 2>&1 \
17 // RUN: | %fcheck-generic
18
19 // --------------------------------------------------
20 // Check 'to' and extends after
21 // --------------------------------------------------
22
23 // RUN: %libomptarget-compile-generic \
24 // RUN: -DCLAUSE=to -DEXTENDS=AFTER
25 // RUN: %libomptarget-run-generic 2>&1 \
26 // RUN: | %fcheck-generic
27
28 // --------------------------------------------------
29 // Check 'from' and extends after
30 // --------------------------------------------------
31
32 // RUN: %libomptarget-compile-generic \
33 // RUN: -DCLAUSE=from -DEXTENDS=AFTER
34 // RUN: %libomptarget-run-generic 2>&1 \
35 // RUN: | %fcheck-generic
36
37 // END.
38
39 #include <stdio.h>
40
41 #define BEFORE 0
42 #define AFTER 1
43
44 #if EXTENDS == BEFORE
45 #define SMALL 2 : 3
46 #define LARGE 0 : 5
47 #elif EXTENDS == AFTER
48 #define SMALL 0 : 3
49 #define LARGE 0 : 5
50 #else
51 #error EXTENDS undefined
52 #endif
53
main()54 int main() {
55 int arr[5];
56
57 // CHECK-NOT: omptarget
58 #pragma omp target data map(alloc : arr[LARGE])
59 {
60 #pragma omp target update CLAUSE(arr[SMALL])
61 }
62
63 // CHECK: success
64 fprintf(stderr, "success\n");
65
66 // CHECK-NOT: omptarget
67 #pragma omp target data map(alloc : arr[SMALL])
68 {
69 #pragma omp target update CLAUSE(arr[LARGE])
70 }
71
72 // CHECK: success
73 fprintf(stderr, "success\n");
74
75 return 0;
76 }
77