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

#define N 100

#pragma omp declare target
void
f (double a[], double x) {
  int i;

  #pragma omp metadirective \
	when (construct={target}: distribute parallel for) \
	default (parallel for simd)
   for (i = 0; i < N; i++)
     a[i] = x * i;
}
#pragma omp end declare target

int
main (void)
{
  double a[N];

  #pragma omp target teams map(from: a[0:N])
    f (a, 3.14159);

  f (a, 2.71828);

  return 0;
 }

 /* The metadirective should be resolved during Gimplification.  */

/* { dg-final { scan-tree-dump-times "#pragma omp metadirective" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "when \\(construct = .*target.*\\):" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "otherwise:" 1 "original" } } */
/* { dg-final { scan-tree-dump-times "#pragma omp parallel" 2 "original" } } */

/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */