force-parallel-7.c 849 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #define N 500
  2. int A[N+5][N+5][N+5];
  3. void abort (void);
  4. int foo (void)
  5. {
  6. int i, j, k;
  7. for (i = 0; i < N + 5; i++)
  8. for (j = 0; j < N + 5; j++)
  9. for (k = 0; k < N + 5; k++)
  10. A[i][j][k] = i + j + k;
  11. /* Loop i: carried no dependency. */
  12. for (i = 0; i < N; i++)
  13. for (j = 0; j < N; j++)
  14. for (k = 0; k < N; k++)
  15. A[k+1][j+2][i+1] = A[k][j][i+1];
  16. return A[1][5][2];
  17. }
  18. int main (void)
  19. {
  20. if (5 != foo ())
  21. abort ();
  22. return 0;
  23. }
  24. /* Check that parallel code generation part make the right answer. */
  25. /* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
  26. /* { dg-final { cleanup-tree-dump "graphite" } } */
  27. /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
  28. /* { dg-final { cleanup-tree-dump "parloops" } } */
  29. /* { dg-final { cleanup-tree-dump "optimized" } } */