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-oaccdevlow" }
8
9program main
10  implicit none
11  integer, parameter :: n = 1024
12  integer, dimension (0:n-1) :: a, b, c
13  integer :: i
14
15  call setup(a, b)
16
17  !$acc serial loop copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1)) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" }
18  do i = 0, n - 1
19     c(i) = a(i) + b(i)
20  end do
21  !$acc end serial loop
22end program main
23
24! Check the offloaded function's attributes.
25! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc serial, omp target entrypoint\\)\\)" 1 "ompexp" } }
26
27! Check the offloaded function's classification and compute dimensions (will
28! always be 1 x 1 x 1 for non-offloading compilation).
29! { dg-final { scan-tree-dump-times "(?n)Function is OpenACC serial offload" 1 "oaccdevlow" } }
30! { dg-final { scan-tree-dump-times "(?n)Compute dimensions \\\[1, 1, 1\\\]" 1 "oaccdevlow" } }
31! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc function \\(1, 1, 1\\), oacc serial, omp target entrypoint\\)\\)" 1 "oaccdevlow" } }
32