| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
module reduction5 |
| 4 |
intrinsic ior, min, max |
| 5 |
end module reduction5 |
| 6 |
|
| 7 |
call test1 |
| 8 |
call test2 |
| 9 |
contains |
| 10 |
subroutine test1 |
| 11 |
use reduction5, bitwise_or => ior |
| 12 |
integer :: n |
| 13 |
n = int(Z'f') |
| 14 |
!$omp parallel sections num_threads (3) reduction (bitwise_or: n) |
| 15 |
n = ior (n, int(Z'20')) |
| 16 |
!$omp section |
| 17 |
n = bitwise_or (int(Z'410'), n) |
| 18 |
!$omp section |
| 19 |
n = bitwise_or (n, int(Z'2000')) |
| 20 |
!$omp end parallel sections |
| 21 |
if (n .ne. int(Z'243f')) stop 1 |
| 22 |
end subroutine |
| 23 |
subroutine test2 |
| 24 |
use reduction5, min => max, max => min |
| 25 |
integer :: m, n |
| 26 |
m = 8 |
| 27 |
n = 4 |
| 28 |
!$omp parallel sections num_threads (3) reduction (min: n) & |
| 29 |
!$omp & reduction (max: m) |
| 30 |
if (m .gt. 13) m = 13 |
| 31 |
if (n .lt. 11) n = 11 |
| 32 |
!$omp section |
| 33 |
if (m .gt. 5) m = 5 |
| 34 |
if (n .lt. 15) n = 15 |
| 35 |
!$omp section |
| 36 |
if (m .gt. 3) m = 3 |
| 37 |
if (n .lt. -1) n = -1 |
| 38 |
!$omp end parallel sections |
| 39 |
if (m .ne. 3 .or. n .ne. 15) stop 2 |
| 40 |
end subroutine test2 |
| 41 |
end |
| 42 |
|
| 43 |
! { dg-final { cleanup-modules "reduction5" } } |