collapse-6.f90 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ! { dg-do run }
  2. ! collapse3.f90:test3
  3. program collapse6
  4. integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19)
  5. integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9
  6. logical :: l, r
  7. l = .false.
  8. r = .false.
  9. a(:, :, :) = 0
  10. b(:, :, :) = 0
  11. v1 = 3
  12. v2 = 6
  13. v3 = -2
  14. v4 = 4
  15. v5 = 13
  16. v6 = 18
  17. v7 = 1
  18. v8 = 1
  19. v9 = 1
  20. !$acc parallel
  21. !$acc loop collapse (3) reduction (.or.:l)
  22. do i = v1, v2, v7
  23. do j = v3, v4, v8
  24. do k = v5, v6, v9
  25. l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
  26. l = l.or.k.lt.13.or.k.gt.18
  27. if (.not.l) a(i, j, k) = a(i, j, k) + 1
  28. end do
  29. end do
  30. end do
  31. !$acc end parallel
  32. do i = v1, v2, v7
  33. do j = v3, v4, v8
  34. do k = v5, v6, v9
  35. r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
  36. r = r.or.k.lt.13.or.k.gt.18
  37. if (.not.r) b(i, j, k) = b(i, j, k) + 1
  38. end do
  39. end do
  40. end do
  41. if (l .neqv. r) call abort
  42. do i = v1, v2, v7
  43. do j = v3, v4, v8
  44. do k = v5, v6, v9
  45. if (a(i, j, k) .ne. b(i, j, k)) call abort
  46. end do
  47. end do
  48. end do
  49. end program collapse6