1 /* { dg-additional-options "-fdump-tree-omplower" } */
3 /* { dg-final { scan-tree-dump-times "omp declare target\[^ \]" 3 "omplower" } } */
5 /* { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare target\\)\\)\[\n\r\]*int called_in_target1" 1 "omplower" } } */
6 /* { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare target\\)\\)\[\n\r\]*int called_in_target2" 1 "omplower" } } */
7 /* { dg-final { scan-tree-dump-times "__attribute__\\(\\(omp declare target, omp declare target block\\)\\)\[\n\r\]*void tg_fn" 1 "omplower" } } */
9 #pragma omp requires reverse_offload
11 extern int add_3 (int);
13 static int global_var
= 5;
16 check_offload (int *x
, int *y
)
34 #pragma omp declare target
36 tg_fn (int *x
, int *y
)
39 if (x2
!= 2 || y2
!= 3)
41 x2
= x2
+ 2 + called_in_target1 ();
44 #pragma omp target device(ancestor : 1) map(tofrom: x2)
45 check_offload(&x2
, &y2
);
47 if (x2
!= 2+2+3+42 || y2
!= 3 + 7)
51 #pragma omp end declare target
54 my_func (int *x
, int *y
)
75 x
+= called_in_target2 ();
76 #pragma omp target device ( ancestor:1 ) firstprivate(y) map(tofrom:x)
78 if (x
!= -2-6 || y
!= -1)
81 if (x
!= 2*(3-2) || y
!= 3*(3-1))
84 if (x
!= 2*(3-2) || y
!= -1)
88 if (global_var
!= 242)