2 // { dg-options "-fopenmp -fdump-tree-gimple" }
6 void bar2 (int, long *, long *);
8 #pragma omp declare target to (bar, baz, v)
12 foo (int a, int b, long c, long d)
14 /* The OpenMP 4.5 spec says that these expressions are evaluated before
15 target region on combined target teams, so those cases are always
22 #pragma omp target teams
25 #pragma omp teams num_teams (4)
27 #pragma omp target teams num_teams (4)
30 #pragma omp teams thread_limit (7)
32 #pragma omp target teams thread_limit (7)
35 #pragma omp teams num_teams (4) thread_limit (8)
41 #pragma omp target teams num_teams (4) thread_limit (8)
44 #pragma omp teams num_teams (a) thread_limit (b)
46 #pragma omp target teams num_teams (a) thread_limit (b)
49 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
51 #pragma omp target teams num_teams (c + 1) thread_limit (d - 1)
53 #pragma omp target map (always, to: c, d)
54 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
56 #pragma omp target data map (to: c, d)
58 #pragma omp target defaultmap (tofrom: scalar)
60 /* This is one of the cases which can't be generally optimized,
61 the c and d are (or could be) already mapped and whether
62 their device and original values match is unclear. */
63 #pragma omp target map (to: c, d)
64 #pragma omp teams num_teams (c + 1) thread_limit (d - 1)
67 /* This can't be optimized, there are function calls inside of
70 #pragma omp teams num_teams (baz () + 1) thread_limit (baz () - 1)
72 #pragma omp target teams num_teams (baz () + 1) thread_limit (baz () - 1)
74 /* This one can't be optimized, as v might have different value between
77 #pragma omp teams num_teams (v + 1) thread_limit (v - 1)
82 foo (int a, int b, long c, long d)
87 /* { dg-final { scan-tree-dump-times "num_teams\\(-1\\)" 3 "gimple" } } */
88 /* { dg-final { scan-tree-dump-times "thread_limit\\(-1\\)" 3 "gimple" } } */
89 /* { dg-final { scan-tree-dump-times "num_teams\\(0\\)" 4 "gimple" } } */
90 /* { dg-final { scan-tree-dump-times "thread_limit\\(0\\)" 6 "gimple" } } */
91 /* { dg-final { scan-tree-dump-times "num_teams\\(1\\)" 2 "gimple" } } */
92 /* { dg-final { scan-tree-dump-times "thread_limit\\(1\\)" 0 "gimple" } } */