]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gfortran.dg/goacc/kernels-loop-data-2.f95
[PR middle-end/69921] Use "oacc kernels parallelized" attribute for parallelized...
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / goacc / kernels-loop-data-2.f95
CommitLineData
bf751f40
TV
1! { dg-additional-options "-O2" }
2! { dg-additional-options "-fdump-tree-parloops1-all" }
3! { dg-additional-options "-fdump-tree-optimized" }
4
5program main
6 implicit none
7 integer, parameter :: n = 1024
8 integer, dimension (0:n-1) :: a, b, c
9 integer :: i, ii
10
11 !$acc data copyout (a(0:n-1))
12 !$acc kernels present (a(0:n-1))
13 do i = 0, n - 1
14 a(i) = i * 2
15 end do
16 !$acc end kernels
17 !$acc end data
18
19 !$acc data copyout (b(0:n-1))
20 !$acc kernels present (b(0:n-1))
21 do i = 0, n -1
22 b(i) = i * 4
23 end do
24 !$acc end kernels
25 !$acc end data
26
27 !$acc data copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
28 !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
29 do ii = 0, n - 1
30 c(ii) = a(ii) + b(ii)
31 end do
32 !$acc end kernels
33 !$acc end data
34
35 do i = 0, n - 1
36 if (c(i) .ne. a(i) + b(i)) call abort
37 end do
38
39end program main
40
41! Check that only three loops are analyzed, and that all can be parallelized.
42! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
b0f271ce 43! { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 3 "parloops1" } }
bf751f40
TV
44! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
45
46! Check that the loop has been split off into a function.
47! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
48! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
49! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }