1 ! { dg-additional-options "-O2" }
2 ! { dg-additional-options "-fdump-tree-parloops1-all" }
3 ! { dg-additional-options "-fdump-tree-optimized" }
7 integer, parameter :: n
= 1024
8 integer, dimension (0:n
-1) :: a
, b
, c
11 !$acc enter data create (a(0:n-1))
12 !$acc kernels present (a(0:n-1))
17 !$acc exit data copyout (a(0:n-1))
19 !$acc enter data create (b(0:n-1))
20 !$acc kernels present (b(0:n-1))
25 !$acc exit data copyout (b(0:n-1))
27 !$acc enter data copyin (a(0:n-1), b(0:n-1)) create (c(0:n-1))
28 !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
33 !$acc exit data copyout (c(0:n-1))
36 if (c(i
) .ne
. a(i
) + b(i
)) call abort
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" } }
43 ! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
45 ! Check that the loop has been split off into a function.
46 ! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
47 ! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
48 ! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }