Use "oacc kernels" attribute for OpenACC kernels
[official-gcc.git] / gcc / testsuite / c-c++-common / goacc / classify-kernels-unparallelized.c
blob70ff428b9987dec358de1607c544d6387dc9f17c
1 /* Check offloaded function's attributes and classification for unparallelized
2 OpenACC kernels. */
4 /* { dg-additional-options "-O2" }
5 { dg-additional-options "-fdump-tree-ompexp" }
6 { dg-additional-options "-fdump-tree-parloops1-all" }
7 { dg-additional-options "-fdump-tree-oaccdevlow" } */
9 #define N 1024
11 extern unsigned int *__restrict a;
12 extern unsigned int *__restrict b;
13 extern unsigned int *__restrict c;
15 /* An "extern"al mapping of loop iterations/array indices makes the loop
16 unparallelizable. */
17 extern unsigned int f (unsigned int);
19 void KERNELS ()
21 #pragma acc kernels copyin (a[0:N], b[0:N]) copyout (c[0:N])
22 for (unsigned int i = 0; i < N; i++)
23 c[i] = a[f (i)] + b[f (i)];
26 /* Check the offloaded function's attributes.
27 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } } */
29 /* Check that exactly one OpenACC kernels construct is analyzed, and that it
30 can't be parallelized.
31 { dg-final { scan-tree-dump-times "FAILED:" 1 "parloops1" } }
32 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
33 { dg-final { scan-tree-dump-not "SUCCESS: may be parallelized" "parloops1" } } */
35 /* Check the offloaded function's classification and compute dimensions (will
36 always be 1 x 1 x 1 for non-offloading compilation).
37 { dg-final { scan-tree-dump-times "(?n)Function is OpenACC kernels offload" 1 "oaccdevlow" } }
38 { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
39 { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } } */