Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/attrs-metadirective-7.c

raw
1 /* { dg-do compile { target { c || c++11 } } } */
2 /* { dg-options "-fopenmp -std=c23" { target { c } } } */
3 /* { dg-additional-options "-fdump-tree-gimple -fdump-tree-ompdevlow" } */
4
5 #define N 256
6
7 void
8 f (int a[], int num)
9 {
10 int i;
11
12 [[omp::directive (metadirective
13 when (target_device={device_num(num), kind("gpu"), arch("nvptx")}:
14 target parallel for map(tofrom: a[0:N]))
15 when (target_device={device_num(num), kind("gpu"),
16 arch("amdgcn"), isa("gfx906")}:
17 target parallel for)
18 when (target_device={device_num(num), kind("cpu"), arch("x86_64")}:
19 parallel for))]]
20 for (i = 0; i < N; i++)
21 a[i] += i;
22
23 [[omp::directive (metadirective
24 when (target_device={kind("gpu"), arch("nvptx")}:
25 target parallel for map(tofrom: a[0:N])))]]
26 for (i = 0; i < N; i++)
27 a[i] += i;
28 }
29
30 /* For configurations with offloading, we expect one "pragma omp target"
31 with "device(num)" for each target_device selector that specifies
32 "device_num(num)". Without offloading, there should be zero as the
33 resolution happens during gimplification. */
34 /* { dg-final { scan-tree-dump-times "pragma omp target\[^\\n\]* device\\(num" 3 "gimple" { target offloading_enabled } } } */
35 /* { dg-final { scan-tree-dump-times "pragma omp target\[^\\n\]* device\\(num" 0 "gimple" { target { ! offloading_enabled } } } } */
36
37 /* For configurations with offloading, expect one OMP_TARGET_DEVICE_MATCHES
38 for each kind/arch/isa selector. These are supposed to go away after
39 ompdevlow. */
40 /* { dg-final { scan-tree-dump-times "OMP_TARGET_DEVICE_MATCHES" 9 "gimple" { target offloading_enabled } } } */
41 /* { dg-final { scan-tree-dump-times "OMP_TARGET_DEVICE_MATCHES" 0 "gimple" { target { ! offloading_enabled } } } } */
42 /* { dg-final { scan-tree-dump-times "OMP_TARGET_DEVICE_MATCHES" 0 "ompdevlow" { target offloading_enabled } } } */