Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/append-args-5.c

raw
1 /* { dg-additional-options "-fdump-tree-gimple" } */
2
3 /* Check that append_args is not applied when the outermost function
4 in '#pragma omp dispatch' is not variant substituted. */
5
6 #if __cplusplus >= 201103L
7 # define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
8 #else
9 # define __GOMP_UINTPTR_T_ENUM
10 #endif
11
12 typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
13 {
14 omp_interop_none = 0,
15 __omp_interop_t_max__ = __UINTPTR_MAX__
16 } omp_interop_t;
17
18 int v1(int, omp_interop_t);
19 #pragma omp declare variant(v1) match(construct={dispatch},user={condition(1)}) append_args(interop(targetsync))
20 int b1(int);
21
22 int v2(int);
23 int v2a(int);
24 #pragma omp declare variant(v2) match(construct={dispatch},user={condition(1)})
25 #pragma omp declare variant(v2a) match(user={condition(1)})
26 int b2(int);
27
28
29 int test (int y1, int y2, int y3, int y4, int num1, int num2, int num3, int num4)
30 {
31 int x1, x2, x3, x4;
32 omp_interop_t obj = omp_interop_none;
33
34 #pragma omp dispatch device(num1) interop(obj)
35 x1 = v1 (b2 (y1), omp_interop_none);
36
37 /* No variant substitution because of nocontext */
38 #pragma omp dispatch device(num2) nocontext(1) interop(obj)
39 x2 = b1 (b2 (y2));
40
41 /* No variant substitution because of novariants */
42 #pragma omp dispatch device(num2) novariants(1) interop(obj)
43 x3 = b1 (b2 (y3));
44
45 /* OK */
46 #pragma omp dispatch device(num4) nocontext(0) interop(obj)
47 x4 = b1 (b2 (y4));
48
49 return x1 + x2 + x3 + x4;
50 }