diff mbox series

[committed] Fix atomic_capture-1.f90 testcase

Message ID 119df18e-a43b-9d62-bbb9-805b6381c0b6@codesourcery.com
State New
Headers show
Series [committed] Fix atomic_capture-1.f90 testcase | expand

Commit Message

Andrew Stubbs Nov. 25, 2020, 2:02 p.m. UTC
This libgomp OpenACC testcase makes assumptions about the order in which 
loop iterations will run that are invalid on amdgcn. Apparently nvptx 
does work that way, but I find that surprising in itself.

For example, this patch ensures that where a test expects one bit left 
set, or unset, then it doesn't matter which bit it is.

Committed as obvious. Please revert if that turns out not true.

Andrew
diff mbox series

Patch

Fix atomic_capture-1.f90 testcase

The testcase had invalid assumptions about which loop iterations would run
first and last.

libgomp/ChangeLog

	* testsuite/libgomp.oacc-fortran/atomic_capture-1.f90 (main): Adjust
	expected results.

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90
index 536b3f0030c..0b923d5c5bf 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90
@@ -299,7 +299,7 @@  program main
   ! At most one iarr element can be 0.
   do i = 1, N
      if ((iarr(i) == 0 .and. i /= itmp) &
-         .or. iarr(i) < 0 .or. iarr(i) >= N) STOP 35
+         .or. iarr(i) < 0 .or. iarr(i) > N) STOP 35
   end do
   if (igot /= iexp) STOP 36
 
@@ -336,7 +336,7 @@  program main
 
   !$acc parallel loop copy (igot, itmp)
     do i = 0, N - 1
-      iexpr = ibclr (-2, i)
+      iexpr = ibclr (-1, i)
   !$acc atomic capture
       iarr(i) = igot
       igot = iand (igot, iexpr)
@@ -345,7 +345,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) < 0)) STOP 39
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 39
   end do
   if (igot /= iexp) STOP 40
 
@@ -363,7 +363,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) >= 0)) STOP 41
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 41
   end do
   if (igot /= iexp) STOP 42
 
@@ -381,7 +381,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) < 0)) STOP 43
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 43
   end do
   if (igot /= iexp) STOP 44
 
@@ -398,7 +398,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (1 <= iarr(i) .and. iarr(i) < iexp)) STOP 45
+     if (.not. (1 <= iarr(i) .and. iarr(i) <= iexp)) STOP 45
   end do
   if (igot /= iexp) STOP 46
 
@@ -415,7 +415,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i) == 1 .or. iarr(i) == N)) STOP 47
+     if (.not. (iarr(i) >= 1 .or. iarr(i) <= N)) STOP 47
   end do
   if (igot /= iexp) STOP 48
 
@@ -424,7 +424,7 @@  program main
 
   !$acc parallel loop copy (igot, itmp)
     do i = 0, N - 1
-      iexpr = ibclr (-2, i)
+      iexpr = ibclr (-1, i)
   !$acc atomic capture
       iarr(i) = igot
       igot = iand (iexpr, igot)
@@ -433,7 +433,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) < 0)) STOP 49
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 49
   end do
   if (igot /= iexp) STOP 50
 
@@ -451,7 +451,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) >= 0)) STOP 51
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 51
   end do
   if (igot /= iexp) STOP 52
 
@@ -469,7 +469,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) < 0)) STOP 53
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 53
   end do
   if (igot /= iexp) STOP 54
 
@@ -755,7 +755,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i) == iexp)) STOP 89
+     if (.not. (iarr(i) <= i)) STOP 89
   end do
   if (igot /= iexp) STOP 90
 
@@ -773,7 +773,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) <= 0)) STOP 91
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 91
   end do
   if (igot /= iexp) STOP 92
 
@@ -791,7 +791,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) >= -1)) STOP 93
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 93
   end do
   if (igot /= iexp) STOP 94
 
@@ -809,7 +809,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) <= 0)) STOP 95
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 95
   end do
   if (igot /= iexp) STOP 96
 
@@ -843,7 +843,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i) == iexp )) STOP 99
+     if (.not. (iarr(i) <= i)) STOP 99
   end do
   if (igot /= iexp) STOP 100
 
@@ -861,7 +861,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) <= 0)) STOP 101
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 101
   end do
   if (igot /= iexp) STOP 102
 
@@ -879,7 +879,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) >= iexp)) STOP 103
+     if (.not. (popcnt(iarr(i - 1)) > 0)) STOP 103
   end do
   if (igot /= iexp) STOP 104
 
@@ -897,7 +897,7 @@  program main
   !$acc end parallel loop
 
   do i = 1, N
-     if (.not. (iarr(i - 1) <= iexp)) STOP 105
+     if (.not. (popcnt(iarr(i - 1)) < 32)) STOP 105
   end do
   if (igot /= iexp) STOP 106