aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/adjust-args-6.c
blob: 5dc0ab422ad70868eec6c6d809cf1dfab9c5399e (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
/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-gimple" } */

/* Ensure that adjust_args is only applied when variant substitution happens. */

extern int flag;

void h(int *);
void f(int *);
#pragma omp declare variant(f) match(construct={dispatch}, user={condition(flag)}) adjust_args(need_device_ptr : x)
void g(int *x);

void foo(int *y)
{
  #pragma omp dispatch
    h(y);	/* no substitution */
  #pragma omp dispatch
    f(y);	/* no substitution */
  #pragma omp dispatch
    g(y);	/* conditional with substitution for f */
}

/* { dg-final { scan-tree-dump-times "h \\(y\\);" 1 "gimple" } } */
/* { dg-final { scan-tree-dump-times "f \\(y\\);" 1 "gimple" } } */
/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(y, D\.\[0-9]+\\);" 1 "gimple" } } */
/* { dg-final { scan-tree-dump-times "f \\(D\.\[0-9]+\\);" 1 "gimple" } } */
/* { dg-final { scan-tree-dump-times "g \\(y\\);" 1 "gimple" } } */