Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/classify-routine-nohost.c

raw
1 /* Check offloaded function's attributes and classification for OpenACC
2 routine with 'nohost' clause. */
3
4 /* { dg-additional-options "-O2" }
5 { dg-additional-options "-fopt-info-optimized-omp" }
6 { dg-additional-options "-fdump-tree-ompexp" }
7 { dg-additional-options "-fdump-tree-oaccloops" } */
8
9 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
10 aspects of that functionality. */
11
12 #define N 1024
13
14 extern unsigned int *__restrict a;
15 extern unsigned int *__restrict b;
16 extern unsigned int *__restrict c;
17 #pragma acc declare copyin (a, b) create (c)
18
19 #pragma acc routine nohost worker
20 void ROUTINE ()
21 {
22 #pragma acc loop /* { dg-line l_loop_i1 } */
23 /* { dg-bogus {optimized: assigned OpenACC [^\n\r]+ loop parallelism} {} { target *-*-* } l_loop_i1 } */
24 for (unsigned int i = 0; i < N; i++)
25 c[i] = a[i] + b[i];
26 }
27
28 /* Check the offloaded function's attributes.
29 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(omp declare target \\(nohost worker\\), oacc function \\(0 1, 1 0, 1 0\\)\\)\\)" 1 "ompexp" } } */
30
31 /* Check the offloaded function's classification.
32 { dg-final { scan-tree-dump-times "(?n)Function is OpenACC routine level 1" 1 "oaccloops" } }
33 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' has 'nohost' clause" 1 "oaccloops" { target c } } }
34 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' has 'nohost' clause" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
35 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' has 'nohost' clause" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
36 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE' discarded" 1 "oaccloops" { target c } } }
37 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'void ROUTINE\\(\\)' discarded" 1 "oaccloops" { target { c++ && { ! offloading_enabled } } } } }
38 { dg-final { scan-tree-dump-times "(?n)OpenACC routine 'ROUTINE\\(\\)' discarded" 1 "oaccloops" { target { c++ && offloading_enabled } } } }
39 TODO See PR101551 for 'offloading_enabled' differences.
40 { dg-final { scan-tree-dump-not "(?n)Compute dimensions" "oaccloops" } }
41 { dg-final { scan-tree-dump-not "(?n)__attribute__\\(.*omp declare target \\(nohost" "oaccloops" } }
42 { dg-final { scan-tree-dump-not "(?n)void ROUTINE \\(\\)" "oaccloops" } } */