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
38 // END.
39
40 #include <stdio.h>
41
42 #define BEFORE 0
43 #define AFTER 1
44
45 #if EXTENDS == BEFORE
46 # define SMALL 2:3
47 # define LARGE 0:5
48 #elif EXTENDS == AFTER
49 # define SMALL 0:3
50 # define LARGE 0:5
51 #else
52 # error EXTENDS undefined
53 #endif
54
main()55 int main() {
56 int arr[5];
57
58 // CHECK-NOT: Libomptarget
59 #pragma omp target data map(alloc: arr[LARGE])
60 {
61 #pragma omp target update CLAUSE(arr[SMALL])
62 }
63
64 // CHECK: success
65 fprintf(stderr, "success\n");
66
67 // CHECK-NOT: Libomptarget
68 #pragma omp target data map(alloc: arr[SMALL])
69 {
70 #pragma omp target update CLAUSE(arr[LARGE])
71 }
72
73 // CHECK: success
74 fprintf(stderr, "success\n");
75
76 return 0;
77 }
78