Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/classify-serial.c

raw
1 /* Check offloaded function's attributes and classification for OpenACC
2 serial. */
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
18 void SERIAL ()
19 {
20 #pragma acc serial loop copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-line l_compute_loop_i1 } */
21 /* { dg-bogus "warning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } l_compute_loop_i1 }
22 { dg-bogus "warning: region contains worker partitioned code but is not worker partitioned" "" { target *-*-* } l_compute_loop_i1 }
23 { dg-bogus "warning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } l_compute_loop_i1 }
24 TODO Should we really diagnose this if the user explicitly requested 'serial'?
25 TODO Should we instead diagnose ('-Wextra' category?) that the user may enable use of parallelism if replacing 'serial' with 'parallel', if applicable? */
26 /* { dg-optimized {assigned OpenACC gang vector loop parallelism} {} { target *-*-* } l_compute_loop_i1 } */
27 for (unsigned int i = 0; i < N; i++)
28 c[i] = a[i] + b[i];
29 }
30
31 /* Check the offloaded function's attributes.
32 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint, noclone\\)\\)" 1 "ompexp" } } */
33
34 /* Check the offloaded function's classification and compute dimensions (will
35 always be 1 x 1 x 1 for non-offloading compilation).
36 { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccloops" } }
37 { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccloops" } }
38 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint, noclone\\)\\)" 1 "oaccloops" } } */