Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/metadirective-4.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-fdump-tree-original" } */
3 /* { dg-additional-options "-fdump-tree-gimple" } */
4
5 #define N 100
6
7 #pragma omp declare target
8 void
9 f (double a[], double x) {
10 int i;
11
12 #pragma omp metadirective \
13 when (construct={target}: distribute parallel for) \
14 default (parallel for simd)
15 for (i = 0; i < N; i++)
16 a[i] = x * i;
17 }
18 #pragma omp end declare target
19
20 int
21 main (void)
22 {
23 double a[N];
24
25 #pragma omp target teams map(from: a[0:N])
26 f (a, 3.14159);
27
28 f (a, 2.71828);
29
30 return 0;
31 }
32
33 /* The metadirective should be resolved during Gimplification. */
34
35 /* { dg-final { scan-tree-dump-times "#pragma omp metadirective" 1 "original" } } */
36 /* { dg-final { scan-tree-dump-times "when \\(construct = .*target.*\\):" 1 "original" } } */
37 /* { dg-final { scan-tree-dump-times "otherwise:" 1 "original" } } */
38 /* { dg-final { scan-tree-dump-times "#pragma omp parallel" 2 "original" } } */
39
40 /* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */