2017-04-10 11:32:00 +00:00
|
|
|
! { dg-do run }
|
|
|
|
|
|
|
|
program main
|
|
|
|
integer igot, iexp, iexpr
|
|
|
|
real fgot, fexp
|
|
|
|
integer i
|
|
|
|
integer, parameter :: N = 32
|
|
|
|
logical lgot, lexp
|
|
|
|
|
|
|
|
fgot = 1234.0
|
|
|
|
fexp = 1266.0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = fgot + 1.0
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 1
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 1.0
|
|
|
|
fexp = 2.0**32
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = fgot * 2.0
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 2
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 32.0
|
|
|
|
fexp = fgot - N
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = fgot - 1.0
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 3
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 2**32.0
|
|
|
|
fexp = 1.0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = fgot / 2.0
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 4
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .TRUE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = lgot .and. .FALSE.
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 5
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = lgot .or. .FALSE.
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 6
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = lgot .eqv. .TRUE.
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 7
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .TRUE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = lgot .neqv. .TRUE.
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 8
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 1234.0
|
|
|
|
fexp = 1266.0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = 1.0 + fgot
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 9
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 1.0
|
|
|
|
fexp = 2.0**32
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = 2.0 * fgot
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 10
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 32.0
|
|
|
|
fexp = 32.0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = 2.0 - fgot
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 11
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
fgot = 2.0**16
|
|
|
|
fexp = 2.0**16
|
|
|
|
|
|
|
|
!$acc parallel loop copy (fgot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
fgot = 2.0 / fgot
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (fgot /= fexp) STOP 12
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .TRUE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = .FALSE. .and. lgot
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 13
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = .FALSE. .or. lgot
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 14
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .FALSE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = .TRUE. .eqv. lgot
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 15
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
lgot = .FALSE.
|
|
|
|
lexp = .TRUE.
|
|
|
|
|
|
|
|
!$acc parallel copy (lgot)
|
|
|
|
!$acc atomic update
|
|
|
|
lgot = .TRUE. .neqv. lgot
|
|
|
|
!$acc end atomic
|
|
|
|
!$acc end parallel
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (lgot .neqv. lexp) STOP 16
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = 1
|
|
|
|
iexp = N
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
igot = max (igot, i)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 17
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = N
|
|
|
|
iexp = 1
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
igot = min (igot, i)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 18
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = -1
|
|
|
|
iexp = 0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = ibclr (-2, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = iand (igot, iexpr)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 19
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = 0
|
|
|
|
iexp = -1
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = lshift (1, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = ior (igot, iexpr)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 20
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = -1
|
|
|
|
iexp = 0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = lshift (1, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = ieor (igot, iexpr)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 21
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = 1
|
|
|
|
iexp = N
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
igot = max (i, igot)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 22
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = N
|
|
|
|
iexp = 1
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 1, N
|
|
|
|
!$acc atomic update
|
|
|
|
igot = min (i, igot)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 23
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = -1
|
|
|
|
iexp = 0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = ibclr (-2, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = iand (iexpr, igot)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 24
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = 0
|
|
|
|
iexp = -1
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = lshift (1, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = ior (iexpr, igot)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 25
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
igot = -1
|
|
|
|
iexp = 0
|
|
|
|
|
|
|
|
!$acc parallel loop copy (igot)
|
|
|
|
do i = 0, N - 1
|
|
|
|
iexpr = lshift (1, i)
|
|
|
|
!$acc atomic update
|
|
|
|
igot = ieor (iexpr, igot)
|
|
|
|
!$acc end atomic
|
|
|
|
end do
|
|
|
|
!$acc end parallel loop
|
|
|
|
|
2018-12-28 15:30:48 +00:00
|
|
|
if (igot /= iexp) STOP 26
|
2017-04-10 11:32:00 +00:00
|
|
|
|
|
|
|
end program
|