1 // --------------------------------------------------
2 // Check 'to' and extends before
3 // --------------------------------------------------
4 
5 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
6 // RUN:   -DCLAUSE=to -DEXTENDS=BEFORE
7 // RUN: %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 \
8 // RUN: | %fcheck-aarch64-unknown-linux-gnu
9 
10 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
11 // RUN:   -DCLAUSE=to -DEXTENDS=BEFORE
12 // RUN: %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 \
13 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
14 
15 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
16 // RUN:   -DCLAUSE=to -DEXTENDS=BEFORE
17 // RUN: %libomptarget-run-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:   -DCLAUSE=to -DEXTENDS=BEFORE
22 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
23 // RUN: | %fcheck-x86_64-pc-linux-gnu
24 
25 // --------------------------------------------------
26 // Check 'from' and extends before
27 // --------------------------------------------------
28 
29 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
30 // RUN:   -DCLAUSE=from -DEXTENDS=BEFORE
31 // RUN: %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 \
32 // RUN: | %fcheck-aarch64-unknown-linux-gnu
33 
34 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
35 // RUN:   -DCLAUSE=from -DEXTENDS=BEFORE
36 // RUN: %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 \
37 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
38 
39 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
40 // RUN:   -DCLAUSE=from -DEXTENDS=BEFORE
41 // RUN: %libomptarget-run-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:   -DCLAUSE=from -DEXTENDS=BEFORE
46 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
47 // RUN: | %fcheck-x86_64-pc-linux-gnu
48 
49 // --------------------------------------------------
50 // Check 'to' and extends after
51 // --------------------------------------------------
52 
53 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
54 // RUN:   -DCLAUSE=to -DEXTENDS=AFTER
55 // RUN: %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 \
56 // RUN: | %fcheck-aarch64-unknown-linux-gnu
57 
58 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
59 // RUN:   -DCLAUSE=to -DEXTENDS=AFTER
60 // RUN: %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 \
61 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
62 
63 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
64 // RUN:   -DCLAUSE=to -DEXTENDS=AFTER
65 // RUN: %libomptarget-run-powerpc64le-ibm-linux-gnu 2>&1 \
66 // RUN: | %fcheck-powerpc64le-ibm-linux-gnu
67 
68 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu \
69 // RUN:   -DCLAUSE=to -DEXTENDS=AFTER
70 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
71 // RUN: | %fcheck-x86_64-pc-linux-gnu
72 
73 // --------------------------------------------------
74 // Check 'from' and extends after
75 // --------------------------------------------------
76 
77 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu \
78 // RUN:   -DCLAUSE=from -DEXTENDS=AFTER
79 // RUN: %libomptarget-run-aarch64-unknown-linux-gnu 2>&1 \
80 // RUN: | %fcheck-aarch64-unknown-linux-gnu
81 
82 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu \
83 // RUN:   -DCLAUSE=from -DEXTENDS=AFTER
84 // RUN: %libomptarget-run-powerpc64-ibm-linux-gnu 2>&1 \
85 // RUN: | %fcheck-powerpc64-ibm-linux-gnu
86 
87 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu \
88 // RUN:   -DCLAUSE=from -DEXTENDS=AFTER
89 // RUN: %libomptarget-run-powerpc64le-ibm-linux-gnu 2>&1 \
90 // RUN: | %fcheck-powerpc64le-ibm-linux-gnu
91 
92 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu \
93 // RUN:   -DCLAUSE=from -DEXTENDS=AFTER
94 // RUN: %libomptarget-run-x86_64-pc-linux-gnu 2>&1 \
95 // RUN: | %fcheck-x86_64-pc-linux-gnu
96 
97 // END.
98 
99 #include <stdio.h>
100 
101 #define BEFORE 0
102 #define AFTER  1
103 
104 #if EXTENDS == BEFORE
105 # define SMALL 2:3
106 # define LARGE 0:5
107 #elif EXTENDS == AFTER
108 # define SMALL 0:3
109 # define LARGE 0:5
110 #else
111 # error EXTENDS undefined
112 #endif
113 
main()114 int main() {
115   int arr[5];
116 
117   // CHECK-NOT: Libomptarget
118 #pragma omp target data map(alloc: arr[LARGE])
119   {
120 #pragma omp target update CLAUSE(arr[SMALL])
121   }
122 
123   // CHECK: success
124   fprintf(stderr, "success\n");
125 
126   // CHECK-NOT: Libomptarget
127 #pragma omp target data map(alloc: arr[SMALL])
128   {
129 #pragma omp target update CLAUSE(arr[LARGE])
130   }
131 
132   // CHECK: success
133   fprintf(stderr, "success\n");
134 
135   return 0;
136 }
137