1 /* { dg-additional-options "-O2" } */
2 /* { dg-additional-options "-fdump-tree-parloops1-all" } */
3 /* { dg-additional-options "-fdump-tree-optimized" } */
4 
5 /* Based on autopar/outer-1.c.  */
6 
7 #include <stdlib.h>
8 
9 #define N 1000
10 
11 int
main(void)12 main (void)
13 {
14   int x[N][N];
15 
16 #pragma acc kernels copyout (x)
17   {
18     for (int ii = 0; ii < N; ii++)
19       for (int jj = 0; jj < N; jj++)
20 	x[ii][jj] = ii + jj + 3;
21   }
22 
23   for (int i = 0; i < N; i++)
24     for (int j = 0; j < N; j++)
25       if (x[i][j] != i + j + 3)
26 	abort ();
27 
28   return 0;
29 }
30 
31 /* Check that only one loop is analyzed, and that it can be parallelized.  */
32 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
33 /* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
34 /* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
35 
36 /* Check that the loop has been split off into a function.  */
37 /* { dg-final { scan-tree-dump-times "(?n);; Function .*main._omp_fn.0" 1 "optimized" } } */
38