1! Check offloaded function's attributes and classification for OpenACC
2! kernels.
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-parloops1-all" }
8! { dg-additional-options "-fdump-tree-oaccdevlow" }
9
10program main
11  implicit none
12  integer, parameter :: n = 1024
13  integer, dimension (0:n-1) :: a, b, c
14  integer :: i
15
16  call setup(a, b)
17
18  !$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang loop parallelism" }
19  do i = 0, n - 1
20     c(i) = a(i) + b(i)
21  end do
22  !$acc end kernels
23end program main
24
25! Check the offloaded function's attributes.
26! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels, omp target entrypoint\\)\\)" 1 "ompexp" } }
27
28! Check that exactly one OpenACC kernels construct is analyzed, and that it
29! can be parallelized.
30! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
31! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } }
32! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
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 parallelized OpenACC kernels offload" 1 "oaccdevlow" } }
37! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
38! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
39