simd5.f90 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ! { dg-do run }
  2. ! { dg-additional-options "-msse2" { target sse2_runtime } }
  3. ! { dg-additional-options "-mavx" { target avx_runtime } }
  4. integer :: i, j, b, c
  5. c = 0
  6. i = 4
  7. j = 4
  8. b = 7
  9. !$omp simd linear(b:2) reduction(+:c)
  10. do i = 0, 63
  11. c = c + b - (7 + 2 * i)
  12. b = b + 2
  13. end do
  14. if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  15. i = 4
  16. j = 4
  17. b = 7
  18. !$omp simd linear(b:3) reduction(+:c)
  19. do i = 0, 63, 4
  20. c = c + b - (7 + i / 4 * 3)
  21. b = b + 3
  22. end do
  23. if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  24. i = 4
  25. j = 4
  26. b = 7
  27. !$omp simd linear(i) linear(b:2) reduction(+:c)
  28. do i = 0, 63
  29. c = c + b - (7 + 2 * i)
  30. b = b + 2
  31. end do
  32. if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  33. i = 4
  34. j = 4
  35. b = 7
  36. !$omp simd linear(i:4) linear(b:3) reduction(+:c)
  37. do i = 0, 63, 4
  38. c = c + b - (7 + i / 4 * 3)
  39. b = b + 3
  40. end do
  41. if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  42. i = 4
  43. j = 4
  44. b = 7
  45. !$omp simd collapse(2) linear(b:2) reduction(+:c)
  46. do i = 0, 7
  47. do j = 0, 7
  48. c = c + b - (7 + 2 * j + 2 * 8 * i)
  49. b = b + 2
  50. end do
  51. end do
  52. if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  53. i = 4
  54. j = 4
  55. b = 7
  56. !$omp simd collapse(2) linear(b:2) reduction(+:c) lastprivate (i, j)
  57. do i = 0, 7
  58. do j = 0, 7
  59. c = c + b - (7 + 2 * j + 2 * 8 * i)
  60. b = b + 2
  61. end do
  62. end do
  63. if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  64. i = 4
  65. j = 4
  66. b = 7
  67. !$omp parallel do simd schedule (static, 4) linear(b:2) reduction(+:c)
  68. do i = 0, 63
  69. c = c + b - (7 + 2 * i)
  70. b = b + 2
  71. end do
  72. if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  73. i = 4
  74. j = 4
  75. b = 7
  76. !$omp parallel do simd schedule (static, 4) linear(b:3) reduction(+:c)
  77. do i = 0, 63, 4
  78. c = c + b - (7 + i / 4 * 3)
  79. b = b + 3
  80. end do
  81. if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  82. i = 4
  83. j = 4
  84. b = 7
  85. !$omp parallel do simd schedule (static, 4) linear(i) linear(b:2) reduction(+:c)
  86. do i = 0, 63
  87. c = c + b - (7 + 2 * i)
  88. b = b + 2
  89. end do
  90. if (c /= 0 .or. i /= 64 .or. b /= 7 + 64 * 2) call abort
  91. i = 4
  92. j = 4
  93. b = 7
  94. !$omp parallel do simd schedule (static, 4) linear(i:4) linear(b:3) reduction(+:c)
  95. do i = 0, 63, 4
  96. c = c + b - (7 + i / 4 * 3)
  97. b = b + 3
  98. end do
  99. if (c /= 0 .or. i /= 64 .or. b /= 7 + 16 * 3) call abort
  100. i = 4
  101. j = 4
  102. b = 7
  103. !$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) reduction(+:c)
  104. do i = 0, 7
  105. do j = 0, 7
  106. c = c + b - (7 + 2 * j + 2 * 8 * i)
  107. b = b + 2
  108. end do
  109. end do
  110. if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  111. i = 4
  112. j = 4
  113. b = 7
  114. !$omp parallel do simd schedule (static, 4) collapse(2) linear(b:2) &
  115. !$omp & reduction(+:c) lastprivate (i, j)
  116. do i = 0, 7
  117. do j = 0, 7
  118. c = c + b - (7 + 2 * j + 2 * 8 * i)
  119. b = b + 2
  120. end do
  121. end do
  122. if (c /= 0 .or. i /= 8 .or. j /= 8 .or. b /= 7 + 64 * 2) call abort
  123. end