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

#define N 1000

void
foo (void)
{
  int a[N], b[N], c[N];

  /* Should generate implicit 'map(present, alloc)' clauses.  */
  #pragma omp target defaultmap (present: aggregate)
    for (int i = 0; i < N; i++)
      c[i] = a[i] + b[i];

  /* Should generate implicit 'map(present, alloc)' clauses,
     and they should go before other non-present clauses.  */
  #pragma omp target map(from: c) defaultmap (present: aggregate)
    for (int i = 0; i < N; i++)
      c[i] = a[i] + b[i];
}

/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:c \\\[len: \[0-9\]+\\\] \\\[runtime_implicit\\\]\\) map\\(force_present:b \\\[len: \[0-9\]+\\\] \\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\] \\\[runtime_implicit\\\]\\)" "gimple" } } */
/* { dg-final { scan-tree-dump "pragma omp target.*defaultmap\\(present:aggregate\\) map\\(force_present:b \\\[len: \[0-9\]+\\\] \\\[runtime_implicit\\\]\\) map\\(force_present:a \\\[len: \[0-9\]+\\\] \\\[runtime_implicit\\\]\\) map\\(from:c \\\[len: \[0-9\]+\\\]\\)" "gimple" } } */