aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/append-args-5.c
blob: 37625566f51d355f1b245bd765c34b45531fc2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* { dg-additional-options "-fdump-tree-gimple" } */

/* Check that append_args is not applied when the outermost function
   in '#pragma omp dispatch' is not variant substituted.  */

#if __cplusplus >= 201103L
# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
#else
# define __GOMP_UINTPTR_T_ENUM
#endif

typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
{
  omp_interop_none = 0,
  __omp_interop_t_max__ = __UINTPTR_MAX__
} omp_interop_t;

int v1(int, omp_interop_t);
#pragma omp declare variant(v1) match(construct={dispatch},user={condition(1)}) append_args(interop(targetsync))
int b1(int);

int v2(int);
int v2a(int);
#pragma omp declare variant(v2) match(construct={dispatch},user={condition(1)})
#pragma omp declare variant(v2a) match(user={condition(1)})
int b2(int);


int test (int y1, int y2, int y3, int y4, int num1, int num2, int num3, int num4)
{
  int x1, x2, x3, x4; 
  omp_interop_t obj = omp_interop_none;

  #pragma omp dispatch device(num1) interop(obj)
    x1 = v1 (b2 (y1), omp_interop_none);

  /* No variant substitution because of nocontext */
  #pragma omp dispatch device(num2) nocontext(1) interop(obj)
    x2 = b1 (b2 (y2));

  /* No variant substitution because of novariants */
  #pragma omp dispatch device(num2) novariants(1) interop(obj)
    x3 = b1 (b2 (y3));

  /* OK */
  #pragma omp dispatch device(num4) nocontext(0) interop(obj)
    x4 = b1 (b2 (y4));

  return x1 + x2 + x3 + x4;
}