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

int f (int a, void *b, float c[2]);

#pragma omp declare variant (f) match (construct={dispatch}) adjust_args (nothing: a) adjust_args (need_device_ptr: b, c)
int f0 (int a, void *b, float c[2]);
#pragma omp declare variant (f) match (construct={dispatch}) adjust_args (nothing: a) adjust_args (need_device_ptr: b) adjust_args (need_device_ptr: c)
int f1 (int a, void *b, float c[2]);

int test () {
  int a;
  void *b;
  float c[2];
  struct {int a;} s;

  s.a = f0 (a, b, c);
  #pragma omp dispatch
  s.a = f0 (a, b, c);

  f1 (a, b, c);
  #pragma omp dispatch
  s.a = f1 (a, b, c);

  return s.a;
}

/* { dg-final { scan-tree-dump-times "__builtin_omp_get_default_device \\(\\);" 2 "gimple" } } */
/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(&c, D\.\[0-9]+\\);" 2 "gimple" } } */
/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(b, D\.\[0-9]+\\);" 2 "gimple" } } */