[gomp5] Default to nonmonotonic schedule for dynamic/guided

Jakub Jelinek jakub@redhat.com
Thu May 4 17:21:00 GMT 2017


Hi!

OpenMP 5.0 will change the default, when neither monotonic nor nonmonotonic
modifier is present on dynamic or guided schedule, it is now nonmonotonic,
while in 4.5 the default was monotonic.

2017-05-04  Jakub Jelinek  <jakub@redhat.com>

	* omp-expand.c (expand_parallel_call, expand_omp_for): For dynamic
	and guided schedule without monotonic and nonmonotonic modifier,
	default to nonmonotonic.

	* gcc.dg/gomp/for-4.c: Expected nonmonotonic functions in the dumps.
	* gcc.dg/gomp/for-5.c: Likewise.
	* g++.dg/gomp/for-4.C: Likewise.
	* g++.dg/gomp/for-5.C: Likewise.

--- gcc/omp-expand.c.jj	2017-05-04 15:05:50.000000000 +0200
+++ gcc/omp-expand.c	2017-05-04 17:58:48.633304639 +0200
@@ -536,8 +536,8 @@ expand_parallel_call (struct omp_region
 	      break;
 	    case OMP_CLAUSE_SCHEDULE_DYNAMIC:
 	    case OMP_CLAUSE_SCHEDULE_GUIDED:
-	      if (region->inner->sched_modifiers
-		  & OMP_CLAUSE_SCHEDULE_NONMONOTONIC)
+	      if ((region->inner->sched_modifiers
+		   & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0)
 		{
 		  start_ix2 = 3 + region->inner->sched_kind;
 		  break;
@@ -5854,7 +5854,7 @@ expand_omp_for (struct omp_region *regio
 	  break;
 	case OMP_CLAUSE_SCHEDULE_DYNAMIC:
 	case OMP_CLAUSE_SCHEDULE_GUIDED:
-	  if ((fd.sched_modifiers & OMP_CLAUSE_SCHEDULE_NONMONOTONIC)
+	  if ((fd.sched_modifiers & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0
 	      && !fd.ordered
 	      && !fd.have_ordered)
 	    {
--- gcc/testsuite/gcc.dg/gomp/for-4.c.jj	2017-05-04 15:05:34.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/for-4.c	2017-05-04 18:17:27.792233682 +0200
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_dynamic_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_dynamic_next" 1 "ompexp" } } */
--- gcc/testsuite/gcc.dg/gomp/for-5.c.jj	2017-05-04 15:05:34.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/for-5.c	2017-05-04 18:19:16.363931760 +0200
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_guided_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_guided_next" 1 "ompexp" } } */
--- gcc/testsuite/g++.dg/gomp/for-4.C.jj	2017-05-04 15:05:46.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/for-4.C	2017-05-04 18:18:00.182845275 +0200
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_dynamic_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_dynamic_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_dynamic_next" 1 "ompexp" } } */
--- gcc/testsuite/g++.dg/gomp/for-5.C.jj	2017-05-04 15:05:46.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/for-5.C	2017-05-04 18:18:12.796694018 +0200
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_guided_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_guided_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_guided_next" 1 "ompexp" } } */

	Jakub



More information about the Gcc-patches mailing list