]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
omp-builtins.def (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START, [...]): New builtins.
authorJakub Jelinek <jakub@redhat.com>
Thu, 25 Oct 2018 18:36:36 +0000 (20:36 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 25 Oct 2018 18:36:36 +0000 (20:36 +0200)
* omp-builtins.def (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT,
BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT,
BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): New builtins.
* omp-expand.c (expand_parallel_call, expand_omp_for): Emit
the GOMP_*nonmonotonic_runtime* or GOMP_*maybe_nonmonotonic_runtime*
builtins instead of GOMP_*runtime* if there is nonmonotonic modifier
or if there is no modifier and no ordered clause.
gcc/c/
* c-typeck.c (c_finish_omp_clauses): Don't diagnose nonmonotonic clause
with static, runtime or auto schedule kinds.
gcc/cp/
* semantics.c (finish_omp_clauses): Don't diagnose nonmonotonic clause
with static, runtime or auto schedule kinds.
gcc/testsuite/
* g++.dg/gomp/for-6.C: Change expected library call.
* gcc.dg/gomp/for-6.c: Likewise.
* gcc.dg/gomp/combined-1.c: Moved to ...
* c-c++-common/gomp/combined-1.c: ... here.  Adjust expected library
call.
* c-c++-common/gomp/combined-2.c: New test.
* c-c++-common/gomp/combined-3.c: New test.
* c-c++-common/gomp/for-6.c: New test.
* c-c++-common/gomp/for-7.c: New test.
* c-c++-common/gomp/schedule-modifiers-1.c (bar): Don't expect
diagnostics for nonmonotonic modifier with static, runtime or auto
schedule kinds.
libgomp/
* omp.h.in (enum omp_sched_t): Add omp_sched_monotonic.
* libgomp_g.h (GOMP_loop_nonmonotonic_runtime_start,
GOMP_loop_maybe_nonmonotonic_runtime_start,
GOMP_loop_nonmonotonic_runtime_next,
GOMP_loop_maybe_nonmonotonic_runtime_next,
GOMP_parallel_loop_nonmonotonic_runtime,
GOMP_parallel_loop_maybe_nonmonotonic_runtime,
GOMP_loop_ull_nonmonotonic_runtime_start,
GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
GOMP_loop_ull_nonmonotonic_runtime_next,
GOMP_loop_ull_maybe_nonmonotonic_runtime_next): New prototypes.
* libgomp.h (enum gomp_schedule_type): Add GFS_MONOTONIC.
* libgomp.map (GOMP_5.0): Export
GOMP_loop_maybe_nonmonotonic_runtime_next,
GOMP_loop_maybe_nonmonotonic_runtime_start,
GOMP_loop_nonmonotonic_runtime_next,
GOMP_loop_nonmonotonic_runtime_start,
GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
GOMP_loop_ull_nonmonotonic_runtime_next,
GOMP_loop_ull_nonmonotonic_runtime_start,
GOMP_parallel_loop_maybe_nonmonotonic_runtime,
GOMP_parallel_loop_nonmonotonic_runtime.
* env.c (parse_schedule): Parse monotonic and nonmonotonic modifiers
in OMP_SCHEDULE variable.  Set GFS_MONOTONIC for monotonic schedules.
(handle_omp_display_env): Display monotonic/nonmonotonic schedule
modifiers.  Display (non-default) chunk sizes.
* fortran.c (omp_get_schedule_, omp_get_schedule_8_): Mask off
GFS_MONOTONIC bit.
* icv.c (omp_set_schedule): Mask off omp_sched_monotonic bit in switch.
* loop.c (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start,
GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start):
Mask off GFS_MONOTONIC bit.
(GOMP_loop_maybe_nonmonotonic_runtime_next,
GOMP_loop_maybe_nonmonotonic_runtime_start,
GOMP_loop_nonmonotonic_runtime_next,
GOMP_loop_nonmonotonic_runtime_start,
GOMP_parallel_loop_maybe_nonmonotonic_runtime,
GOMP_parallel_loop_nonmonotonic_runtime): New aliases or wrapper
functions.
* loop_ull.c (GOMP_loop_ull_runtime_start,
GOMP_loop_ull_ordered_runtime_start,
GOMP_loop_ull_doacross_runtime_start): Mask off GFS_MONOTONIC bit.
(GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
GOMP_loop_ull_nonmonotonic_runtime_next,
GOMP_loop_ull_nonmonotonic_runtime_start): Likewise.

From-SVN: r265502

26 files changed:
gcc/ChangeLog.gomp
gcc/c/ChangeLog.gomp
gcc/c/c-typeck.c
gcc/cp/ChangeLog.gomp
gcc/cp/semantics.c
gcc/omp-builtins.def
gcc/omp-expand.c
gcc/testsuite/ChangeLog.gomp
gcc/testsuite/c-c++-common/gomp/combined-1.c [moved from gcc/testsuite/gcc.dg/gomp/combined-1.c with 77% similarity]
gcc/testsuite/c-c++-common/gomp/combined-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/combined-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/for-6.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/for-7.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/schedule-modifiers-1.c
gcc/testsuite/g++.dg/gomp/for-6.C
gcc/testsuite/gcc.dg/gomp/for-6.c
libgomp/ChangeLog.gomp
libgomp/env.c
libgomp/fortran.c
libgomp/icv.c
libgomp/libgomp.h
libgomp/libgomp.map
libgomp/libgomp_g.h
libgomp/loop.c
libgomp/loop_ull.c
libgomp/omp.h.in

index 4a3b25d637a01616e33ba346f946759aac20be9b..7940067c0a40cb647d383b0453fccdde3bae9eaf 100644 (file)
@@ -1,3 +1,20 @@
+2018-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * omp-builtins.def (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
+       BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
+       BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT,
+       BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
+       BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
+       BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
+       BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT,
+       BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
+       BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
+       BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME): New builtins.
+       * omp-expand.c (expand_parallel_call, expand_omp_for): Emit
+       the GOMP_*nonmonotonic_runtime* or GOMP_*maybe_nonmonotonic_runtime*
+       builtins instead of GOMP_*runtime* if there is nonmonotonic modifier
+       or if there is no modifier and no ordered clause.
+
 2018-10-23  Jakub Jelinek  <jakub@redhat.com>
 
        * builtin-types.def (BT_FN_UINT_OMPFN_PTR_UINT_UINT): New.
index 838ee68df6b3da85b4073a7f198498f4379c6cdc..51f8e091c41c35d2cf5d7c0da9d2ab53495cf46e 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-typeck.c (c_finish_omp_clauses): Don't diagnose nonmonotonic clause
+       with static, runtime or auto schedule kinds.
+
 2018-10-18  Jakub Jelinek  <jakub@redhat.com>
 
        * c-parser.c (c_parser_omp_taskloop): Add forward declaration.
index 70ec23baadd7b5eb5fa7be637aed3cc843e29c36..329ed2a7e76442fe3ffd32b2c67ef7e6c52a039c 100644 (file)
@@ -14241,29 +14241,6 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          continue;
 
        case OMP_CLAUSE_SCHEDULE:
-         if (OMP_CLAUSE_SCHEDULE_KIND (c) & OMP_CLAUSE_SCHEDULE_NONMONOTONIC)
-           {
-             const char *p = NULL;
-             switch (OMP_CLAUSE_SCHEDULE_KIND (c) & OMP_CLAUSE_SCHEDULE_MASK)
-               {
-               case OMP_CLAUSE_SCHEDULE_STATIC: p = "static"; break;
-               case OMP_CLAUSE_SCHEDULE_DYNAMIC: break;
-               case OMP_CLAUSE_SCHEDULE_GUIDED: break;
-               case OMP_CLAUSE_SCHEDULE_AUTO: p = "auto"; break;
-               case OMP_CLAUSE_SCHEDULE_RUNTIME: p = "runtime"; break;
-               default: gcc_unreachable ();
-               }
-             if (p)
-               {
-                 error_at (OMP_CLAUSE_LOCATION (c),
-                           "%<nonmonotonic%> modifier specified for %qs "
-                           "schedule kind", p);
-                 OMP_CLAUSE_SCHEDULE_KIND (c)
-                   = (enum omp_clause_schedule_kind)
-                     (OMP_CLAUSE_SCHEDULE_KIND (c)
-                      & ~OMP_CLAUSE_SCHEDULE_NONMONOTONIC);
-               }
-           }
          schedule_clause = c;
          pc = &OMP_CLAUSE_CHAIN (c);
          continue;
index 94472fcf6a9d4df7d01816a5aea4a7d930806896..66943fbd4ea415922b2013f82fbf2c3f277434da 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * semantics.c (finish_omp_clauses): Don't diagnose nonmonotonic clause
+       with static, runtime or auto schedule kinds.
+
 2018-10-19  Jakub Jelinek  <jakub@redhat.com>
 
        * parser.c (cp_parser_omp_for_loop): Disallow ordered clause with
index 894fec13cf09a2c6c168753c4c49f958423e781c..7f918a316f47974c967f191428d74b3ed885980c 100644 (file)
@@ -6551,30 +6551,6 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          break;
 
        case OMP_CLAUSE_SCHEDULE:
-         if (OMP_CLAUSE_SCHEDULE_KIND (c) & OMP_CLAUSE_SCHEDULE_NONMONOTONIC)
-           {
-             const char *p = NULL;
-             switch (OMP_CLAUSE_SCHEDULE_KIND (c) & OMP_CLAUSE_SCHEDULE_MASK)
-               {
-               case OMP_CLAUSE_SCHEDULE_STATIC: p = "static"; break;
-               case OMP_CLAUSE_SCHEDULE_DYNAMIC: break;
-               case OMP_CLAUSE_SCHEDULE_GUIDED: break;
-               case OMP_CLAUSE_SCHEDULE_AUTO: p = "auto"; break;
-               case OMP_CLAUSE_SCHEDULE_RUNTIME: p = "runtime"; break;
-               default: gcc_unreachable ();
-               }
-             if (p)
-               {
-                 error_at (OMP_CLAUSE_LOCATION (c),
-                           "%<nonmonotonic%> modifier specified for %qs "
-                           "schedule kind", p);
-                 OMP_CLAUSE_SCHEDULE_KIND (c)
-                   = (enum omp_clause_schedule_kind)
-                     (OMP_CLAUSE_SCHEDULE_KIND (c)
-                      & ~OMP_CLAUSE_SCHEDULE_NONMONOTONIC);
-               }
-           }
-
          t = OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c);
          if (t == NULL)
            ;
index 8782b95a0f3e75120c14c1e3dcdca40eb2bed191..5698af7a6a213e7a709aafee06bc966659c1ef91 100644 (file)
@@ -124,6 +124,14 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_START,
                  "GOMP_loop_nonmonotonic_guided_start",
                  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
                  ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
+                 "GOMP_loop_nonmonotonic_runtime_start",
+                 BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+                 ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
+                 "GOMP_loop_maybe_nonmonotonic_runtime_start",
+                 BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
+                 ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
                  "GOMP_loop_ordered_static_start",
                  BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
@@ -170,6 +178,12 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT,
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT,
                  "GOMP_loop_nonmonotonic_guided_next",
                  BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT,
+                 "GOMP_loop_nonmonotonic_runtime_next",
+                 BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
+                 "GOMP_loop_maybe_nonmonotonic_runtime_next",
+                 BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
                  "GOMP_loop_ordered_static_next",
                  BT_FN_BOOL_LONGPTR_LONGPTR, ATTR_NOTHROW_LEAF_LIST)
@@ -206,6 +220,14 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START,
                  "GOMP_loop_ull_nonmonotonic_guided_start",
                  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
                  ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
+                 "GOMP_loop_ull_nonmonotonic_runtime_start",
+                 BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
+                 ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
+                 "GOMP_loop_ull_maybe_nonmonotonic_runtime_start",
+                 BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
+                 ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_START,
                  "GOMP_loop_ull_ordered_static_start",
                  BT_FN_BOOL_BOOL_ULL_ULL_ULL_ULL_ULLPTR_ULLPTR,
@@ -256,6 +278,12 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT,
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT,
                  "GOMP_loop_ull_nonmonotonic_guided_next",
                  BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT,
+                 "GOMP_loop_ull_nonmonotonic_runtime_next",
+                 BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
+                 "GOMP_loop_ull_maybe_nonmonotonic_runtime_next",
+                 BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_ULL_ORDERED_STATIC_NEXT,
                  "GOMP_loop_ull_ordered_static_next",
                  BT_FN_BOOL_ULONGLONGPTR_ULONGLONGPTR, ATTR_NOTHROW_LEAF_LIST)
@@ -295,6 +323,14 @@ DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED,
                  "GOMP_parallel_loop_nonmonotonic_guided",
                  BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
                  ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
+                 "GOMP_parallel_loop_nonmonotonic_runtime",
+                 BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
+                 ATTR_NOTHROW_LIST)
+DEF_GOMP_BUILTIN (BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
+                 "GOMP_parallel_loop_maybe_nonmonotonic_runtime",
+                 BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
+                 ATTR_NOTHROW_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END, "GOMP_loop_end",
                  BT_FN_VOID, ATTR_NOTHROW_LEAF_LIST)
 DEF_GOMP_BUILTIN (BUILT_IN_GOMP_LOOP_END_CANCEL, "GOMP_loop_end_cancel",
index f33890b907e1d2d25193e88aa8482821f583eec4..11790682857fd545edd898cd4722eb066882a7e6 100644 (file)
@@ -580,7 +580,14 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
          switch (region->inner->sched_kind)
            {
            case OMP_CLAUSE_SCHEDULE_RUNTIME:
-             start_ix2 = 3;
+             if ((region->inner->sched_modifiers
+                  & OMP_CLAUSE_SCHEDULE_NONMONOTONIC) != 0)
+               start_ix2 = 6;
+             else if ((region->inner->sched_modifiers
+                       & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0)
+               start_ix2 = 7;
+             else
+               start_ix2 = 3;
              break;
            case OMP_CLAUSE_SCHEDULE_DYNAMIC:
            case OMP_CLAUSE_SCHEDULE_GUIDED:
@@ -5808,28 +5815,39 @@ expand_omp_for (struct omp_region *region, gimple *inner_stmt)
       if (fd.chunk_size == NULL
          && fd.sched_kind == OMP_CLAUSE_SCHEDULE_STATIC)
        fd.chunk_size = integer_zero_node;
-      gcc_assert (fd.sched_kind != OMP_CLAUSE_SCHEDULE_AUTO);
       switch (fd.sched_kind)
        {
        case OMP_CLAUSE_SCHEDULE_RUNTIME:
-         fn_index = 3;
+         if ((fd.sched_modifiers & OMP_CLAUSE_SCHEDULE_NONMONOTONIC) != 0)
+           {
+             gcc_assert (!fd.have_ordered);
+             fn_index = 6;
+           }
+         else if ((fd.sched_modifiers & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0
+                  && !fd.have_ordered)
+           fn_index = 7;
+         else
+           fn_index = 3;
          break;
        case OMP_CLAUSE_SCHEDULE_DYNAMIC:
        case OMP_CLAUSE_SCHEDULE_GUIDED:
          if ((fd.sched_modifiers & OMP_CLAUSE_SCHEDULE_MONOTONIC) == 0
-             && !fd.ordered
              && !fd.have_ordered)
            {
              fn_index = 3 + fd.sched_kind;
              break;
            }
-         /* FALLTHRU */
-       default:
          fn_index = fd.sched_kind;
          break;
+       case OMP_CLAUSE_SCHEDULE_STATIC:
+         gcc_assert (fd.have_ordered);
+         fn_index = 0;
+         break;
+       default:
+         gcc_unreachable ();
        }
       if (!fd.ordered)
-       fn_index += fd.have_ordered * 6;
+       fn_index += fd.have_ordered * 8;
       if (fd.ordered)
        start_ix = ((int)BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START) + fn_index;
       else
index d67caa1efdeca986a93ab747e8964e50dff4fbac..1d9aa43977098fad07d849c9db3acc2f3bd0558a 100644 (file)
@@ -1,3 +1,18 @@
+2018-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/gomp/for-6.C: Change expected library call.
+       * gcc.dg/gomp/for-6.c: Likewise.
+       * gcc.dg/gomp/combined-1.c: Moved to ...
+       * c-c++-common/gomp/combined-1.c: ... here.  Adjust expected library
+       call.
+       * c-c++-common/gomp/combined-2.c: New test.
+       * c-c++-common/gomp/combined-3.c: New test.
+       * c-c++-common/gomp/for-6.c: New test.
+       * c-c++-common/gomp/for-7.c: New test.
+       * c-c++-common/gomp/schedule-modifiers-1.c (bar): Don't expect
+       diagnostics for nonmonotonic modifier with static, runtime or auto
+       schedule kinds.
+
 2018-10-19  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/gomp/doacross-1.C: New test.
similarity index 77%
rename from gcc/testsuite/gcc.dg/gomp/combined-1.c
rename to gcc/testsuite/c-c++-common/gomp/combined-1.c
index 0c0848c5e7c013b8c6e0908530039bd2c70857f7..4d62844cd2a55696bcd9b76856067a66ad98213b 100644 (file)
@@ -2,7 +2,7 @@
 /* { dg-options "-O1 -fopenmp -fdump-tree-optimized" } */
 
 int a[10];
-int foo (void)
+void foo (void)
 {
     int i;
 #pragma omp parallel for schedule(runtime)
@@ -20,4 +20,4 @@ int foo (void)
       }
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_runtime" 3 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_maybe_nonmonotonic_runtime" 3 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/combined-2.c b/gcc/testsuite/c-c++-common/gomp/combined-2.c
new file mode 100644 (file)
index 0000000..82bc4df
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fopenmp -fdump-tree-optimized" } */
+
+int a[10];
+void foo (void)
+{
+    int i;
+#pragma omp parallel for schedule(monotonic:runtime)
+    for (i = 0; i < 10; i++)
+      a[i] = i;
+#pragma omp parallel
+#pragma omp for schedule(monotonic :runtime)
+    for (i = 0; i < 10; i++)
+      a[i] = 10 - i;
+#pragma omp parallel
+      {
+#pragma omp for schedule(monotonic: runtime)
+       for (i = 0; i < 10; i++)
+         a[i] = i;
+      }
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_runtime" 3 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/combined-3.c b/gcc/testsuite/c-c++-common/gomp/combined-3.c
new file mode 100644 (file)
index 0000000..33c9884
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fopenmp -fdump-tree-optimized" } */
+
+int a[10];
+void foo (void)
+{
+    int i;
+#pragma omp parallel for schedule(nonmonotonic:runtime)
+    for (i = 0; i < 10; i++)
+      a[i] = i;
+#pragma omp parallel
+#pragma omp for schedule(nonmonotonic :runtime)
+    for (i = 0; i < 10; i++)
+      a[i] = 10 - i;
+#pragma omp parallel
+      {
+#pragma omp for schedule(nonmonotonic: runtime)
+       for (i = 0; i < 10; i++)
+         a[i] = i;
+      }
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_parallel_loop_nonmonotonic_runtime" 3 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/for-6.c b/gcc/testsuite/c-c++-common/gomp/for-6.c
new file mode 100644 (file)
index 0000000..274e189
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+  int i;
+
+  #pragma omp for schedule(monotonic:runtime)
+  for (i = 0; i < n; ++i)
+    bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_next" 1 "ompexp" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/for-7.c b/gcc/testsuite/c-c++-common/gomp/for-7.c
new file mode 100644 (file)
index 0000000..5cd0a91
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fdump-tree-ompexp" } */
+
+extern void bar(int);
+
+void foo (int n)
+{
+  int i;
+
+  #pragma omp for schedule(nonmonotonic:runtime)
+  for (i = 0; i < n; ++i)
+    bar(i);
+}
+
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_runtime_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_nonmonotonic_runtime_next" 1 "ompexp" } } */
index 7edea1b147cca4fa83a63febc59975e85f2a2ccc..82ab25722e741a79b4cc33d97ecfa1c63373a4b7 100644 (file)
@@ -68,33 +68,47 @@ void
 bar (void)
 {
   int i;
-  #pragma omp for schedule (nonmonotonic: static, 2)   /* { dg-error ".nonmonotonic. modifier specified for .static. schedule kind" } */
+  #pragma omp for schedule (nonmonotonic: static, 2)
   for (i = 0; i < 64; i++)
     ;
-  #pragma omp for schedule (nonmonotonic : static)     /* { dg-error ".nonmonotonic. modifier specified for .static. schedule kind" } */
+  #pragma omp for schedule (nonmonotonic : static)
   for (i = 0; i < 64; i++)
     ;
-  #pragma omp for schedule (nonmonotonic : runtime)    /* { dg-error ".nonmonotonic. modifier specified for .runtime. schedule kind" } */
+  #pragma omp for schedule (nonmonotonic : runtime)
   for (i = 0; i < 64; i++)
     ;
-  #pragma omp for schedule (nonmonotonic : auto)       /* { dg-error ".nonmonotonic. modifier specified for .auto. schedule kind" } */
+  #pragma omp for schedule (nonmonotonic : auto)
   for (i = 0; i < 64; i++)
     ;
-  #pragma omp for schedule (nonmonotonic, dynamic) ordered     /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  #pragma omp for schedule (nonmonotonic : static) ordered     /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
   for (i = 0; i < 64; i++)
     #pragma omp ordered
       ;
-  #pragma omp for ordered schedule(nonmonotonic, dynamic, 5)   /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  #pragma omp for ordered schedule (nonmonotonic: static, 4)   /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
   for (i = 0; i < 64; i++)
     #pragma omp ordered
       ;
-  #pragma omp for schedule (nonmonotonic, guided) ordered(1)   /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  #pragma omp for schedule (nonmonotonic : dynamic) ordered    /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  for (i = 0; i < 64; i++)
+    #pragma omp ordered
+      ;
+  #pragma omp for ordered schedule(nonmonotonic : dynamic, 5)  /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  for (i = 0; i < 64; i++)
+    #pragma omp ordered
+      ;
+  #pragma omp for schedule (nonmonotonic : guided) ordered(1)  /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
   for (i = 0; i < 64; i++)
     {
       #pragma omp ordered depend(sink: i - 1)
       #pragma omp ordered depend(source)
     }
-  #pragma omp for ordered(1) schedule(nonmonotonic, guided, 2) /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  #pragma omp for ordered(1) schedule(nonmonotonic : guided, 2)        /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
+  for (i = 0; i < 64; i++)
+    {
+      #pragma omp ordered depend(source)
+      #pragma omp ordered depend(sink: i - 1)
+    }
+  #pragma omp for schedule(nonmonotonic : runtime) ordered(1)  /* { dg-error ".nonmonotonic. schedule modifier specified together with .ordered. clause" } */
   for (i = 0; i < 64; i++)
     {
       #pragma omp ordered depend(source)
index 9f9db4102fd29d006284fd364694167e431cc55d..9762be6fd06ec7fe5185a12f91ab329198517346 100644 (file)
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_maybe_nonmonotonic_runtime_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_maybe_nonmonotonic_runtime_next" 1 "ompexp" } } */
index 9f9db4102fd29d006284fd364694167e431cc55d..9762be6fd06ec7fe5185a12f91ab329198517346 100644 (file)
@@ -12,5 +12,5 @@ void foo (int n)
     bar(i);
 }
 
-/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_start" 1 "ompexp" } } */
-/* { dg-final { scan-tree-dump-times "GOMP_loop_runtime_next" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_maybe_nonmonotonic_runtime_start" 1 "ompexp" } } */
+/* { dg-final { scan-tree-dump-times "GOMP_loop_maybe_nonmonotonic_runtime_next" 1 "ompexp" } } */
index ed063eafe19437870d496962bb5bb8bf77a1b891..347c3efbeafa5bfa346d4b7678a2f2e4e525d0ad 100644 (file)
@@ -1,3 +1,53 @@
+2018-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * omp.h.in (enum omp_sched_t): Add omp_sched_monotonic.
+       * libgomp_g.h (GOMP_loop_nonmonotonic_runtime_start,
+       GOMP_loop_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_nonmonotonic_runtime_next,
+       GOMP_loop_maybe_nonmonotonic_runtime_next,
+       GOMP_parallel_loop_nonmonotonic_runtime,
+       GOMP_parallel_loop_maybe_nonmonotonic_runtime,
+       GOMP_loop_ull_nonmonotonic_runtime_start,
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_ull_nonmonotonic_runtime_next,
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_next): New prototypes.
+       * libgomp.h (enum gomp_schedule_type): Add GFS_MONOTONIC.
+       * libgomp.map (GOMP_5.0): Export
+       GOMP_loop_maybe_nonmonotonic_runtime_next,
+       GOMP_loop_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_nonmonotonic_runtime_next,
+       GOMP_loop_nonmonotonic_runtime_start,
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_ull_nonmonotonic_runtime_next,
+       GOMP_loop_ull_nonmonotonic_runtime_start,
+       GOMP_parallel_loop_maybe_nonmonotonic_runtime,
+       GOMP_parallel_loop_nonmonotonic_runtime.
+       * env.c (parse_schedule): Parse monotonic and nonmonotonic modifiers
+       in OMP_SCHEDULE variable.  Set GFS_MONOTONIC for monotonic schedules.
+       (handle_omp_display_env): Display monotonic/nonmonotonic schedule
+       modifiers.  Display (non-default) chunk sizes.
+       * fortran.c (omp_get_schedule_, omp_get_schedule_8_): Mask off
+       GFS_MONOTONIC bit.
+       * icv.c (omp_set_schedule): Mask off omp_sched_monotonic bit in switch.
+       * loop.c (GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start,
+       GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start):
+       Mask off GFS_MONOTONIC bit.
+       (GOMP_loop_maybe_nonmonotonic_runtime_next,
+       GOMP_loop_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_nonmonotonic_runtime_next,
+       GOMP_loop_nonmonotonic_runtime_start,
+       GOMP_parallel_loop_maybe_nonmonotonic_runtime,
+       GOMP_parallel_loop_nonmonotonic_runtime): New aliases or wrapper
+       functions.
+       * loop_ull.c (GOMP_loop_ull_runtime_start,
+       GOMP_loop_ull_ordered_runtime_start,
+       GOMP_loop_ull_doacross_runtime_start): Mask off GFS_MONOTONIC bit.
+       (GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
+       GOMP_loop_ull_nonmonotonic_runtime_next,
+       GOMP_loop_ull_nonmonotonic_runtime_start): Likewise.
+
 2018-10-23  Jakub Jelinek  <jakub@redhat.com>
 
        * libgomp.h (gomp_parallel_reduction_register): Declare.
index f32c43fcd039fa2e724073ec66d598f1818698d1..2c9a609d6072385f3c1b47bc2d97cee130fa4be8 100644 (file)
@@ -104,6 +104,7 @@ parse_schedule (void)
 {
   char *env, *end;
   unsigned long value;
+  int monotonic = 0;
 
   env = getenv ("OMP_SCHEDULE");
   if (env == NULL)
@@ -111,6 +112,26 @@ parse_schedule (void)
 
   while (isspace ((unsigned char) *env))
     ++env;
+  if (strncasecmp (env, "monotonic", 9) == 0)
+    {
+      monotonic = 1;
+      env += 9;
+    }
+  else if (strncasecmp (env, "nonmonotonic", 12) == 0)
+    {
+      monotonic = -1;
+      env += 12;
+    }
+  if (monotonic)
+    {
+      while (isspace ((unsigned char) *env))
+       ++env;
+      if (*env != ':')
+       goto unknown;
+      ++env;
+      while (isspace ((unsigned char) *env))
+       ++env;
+    }
   if (strncasecmp (env, "static", 6) == 0)
     {
       gomp_global_icv.run_sched_var = GFS_STATIC;
@@ -134,12 +155,16 @@ parse_schedule (void)
   else
     goto unknown;
 
+  if (monotonic == 1
+      || (monotonic == 0 && gomp_global_icv.run_sched_var == GFS_STATIC))
+    gomp_global_icv.run_sched_var |= GFS_MONOTONIC;
+
   while (isspace ((unsigned char) *env))
     ++env;
   if (*env == '\0')
     {
       gomp_global_icv.run_sched_chunk_size
-       = gomp_global_icv.run_sched_var != GFS_STATIC;
+       = (gomp_global_icv.run_sched_var & ~GFS_MONOTONIC) != GFS_STATIC;
       return;
     }
   if (*env++ != ',')
@@ -162,7 +187,8 @@ parse_schedule (void)
   if ((int)value != value)
     goto invalid;
 
-  if (value == 0 && gomp_global_icv.run_sched_var != GFS_STATIC)
+  if (value == 0
+      && (gomp_global_icv.run_sched_var & ~GFS_MONOTONIC) != GFS_STATIC)
     value = 1;
   gomp_global_icv.run_sched_chunk_size = value;
   return;
@@ -1153,19 +1179,34 @@ handle_omp_display_env (unsigned long stacksize, int wait_policy)
   fputs ("'\n", stderr);
 
   fprintf (stderr, "  OMP_SCHEDULE = '");
-  switch (gomp_global_icv.run_sched_var)
+  if ((gomp_global_icv.run_sched_var & GFS_MONOTONIC))
+    {
+      if (gomp_global_icv.run_sched_var != (GFS_MONOTONIC | GFS_STATIC))
+       fputs ("MONOTONIC:", stderr);
+    }
+  else if (gomp_global_icv.run_sched_var == GFS_STATIC)
+    fputs ("NONMONOTONIC:", stderr);
+  switch (gomp_global_icv.run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_RUNTIME:
       fputs ("RUNTIME", stderr);
+      if (gomp_global_icv.run_sched_chunk_size != 1)
+       fprintf (stderr, ",%d", gomp_global_icv.run_sched_chunk_size);
       break;
     case GFS_STATIC:
       fputs ("STATIC", stderr);
+      if (gomp_global_icv.run_sched_chunk_size != 0)
+       fprintf (stderr, ",%d", gomp_global_icv.run_sched_chunk_size);
       break;
     case GFS_DYNAMIC:
       fputs ("DYNAMIC", stderr);
+      if (gomp_global_icv.run_sched_chunk_size != 1)
+       fprintf (stderr, ",%d", gomp_global_icv.run_sched_chunk_size);
       break;
     case GFS_GUIDED:
       fputs ("GUIDED", stderr);
+      if (gomp_global_icv.run_sched_chunk_size != 1)
+       fprintf (stderr, ",%d", gomp_global_icv.run_sched_chunk_size);
       break;
     case GFS_AUTO:
       fputs ("AUTO", stderr);
index 5c2cb03662d8c40f78ce19f3bcff60908a2b609b..0157baec648dbdb18ec2ac662d624c15ef909766 100644 (file)
@@ -372,7 +372,9 @@ omp_get_schedule_ (int32_t *kind, int32_t *chunk_size)
   omp_sched_t k;
   int cs;
   omp_get_schedule (&k, &cs);
-  *kind = k;
+  /* For now mask off GFS_MONOTONIC, because OpenMP 4.5 code will not
+     expect to see it.  */
+  *kind = k & ~GFS_MONOTONIC;
   *chunk_size = cs;
 }
 
@@ -382,7 +384,8 @@ omp_get_schedule_8_ (int32_t *kind, int64_t *chunk_size)
   omp_sched_t k;
   int cs;
   omp_get_schedule (&k, &cs);
-  *kind = k;
+  /* See above.  */
+  *kind = k & ~GFS_MONOTONIC;
   *chunk_size = cs;
 }
 
index 42db4fe6c88bb2b9020d06a500e918b1c0f93b4e..68c400aec817eb0cc148d3dcfa8fe68a792e823e 100644 (file)
@@ -69,7 +69,7 @@ void
 omp_set_schedule (omp_sched_t kind, int chunk_size)
 {
   struct gomp_task_icv *icv = gomp_icv (true);
-  switch (kind)
+  switch (kind & ~omp_sched_monotonic)
     {
     case omp_sched_static:
       if (chunk_size < 1)
index 7db21e9b65a57292930e253a9ecd23c154acb821..aed5e51aff1aa125a372f7461d9b2d123a3ae4c7 100644 (file)
@@ -141,7 +141,8 @@ enum gomp_schedule_type
   GFS_STATIC,
   GFS_DYNAMIC,
   GFS_GUIDED,
-  GFS_AUTO
+  GFS_AUTO,
+  GFS_MONOTONIC = 0x80000000U
 };
 
 struct gomp_doacross_work_share
index 866ca32e7e0e304de57d9ae39cc620fc6fa7866d..0ea7578e027bd794df0bc1f0aa057bf72b848229 100644 (file)
@@ -316,6 +316,16 @@ GOMP_4.5 {
 
 GOMP_5.0 {
   global:
+       GOMP_loop_maybe_nonmonotonic_runtime_next;
+       GOMP_loop_maybe_nonmonotonic_runtime_start;
+       GOMP_loop_nonmonotonic_runtime_next;
+       GOMP_loop_nonmonotonic_runtime_start;
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_next;
+       GOMP_loop_ull_maybe_nonmonotonic_runtime_start;
+       GOMP_loop_ull_nonmonotonic_runtime_next;
+       GOMP_loop_ull_nonmonotonic_runtime_start;
+       GOMP_parallel_loop_maybe_nonmonotonic_runtime;
+       GOMP_parallel_loop_nonmonotonic_runtime;
        GOMP_parallel_reductions;
        GOMP_taskgroup_reduction_register;
        GOMP_taskgroup_reduction_unregister;
index d7399eb5c19fe1cdb09b8abaa75fcfdd06ca3f96..6d24a4f0192a1831ac88a243f1155e93e4f3ceab 100644 (file)
@@ -57,6 +57,10 @@ extern bool GOMP_loop_nonmonotonic_dynamic_start (long, long, long, long,
                                                  long *, long *);
 extern bool GOMP_loop_nonmonotonic_guided_start (long, long, long, long,
                                                 long *, long *);
+extern bool GOMP_loop_nonmonotonic_runtime_start (long, long, long,
+                                                 long *, long *);
+extern bool GOMP_loop_maybe_nonmonotonic_runtime_start (long, long, long,
+                                                       long *, long *);
 
 extern bool GOMP_loop_ordered_static_start (long, long, long, long,
                                            long *, long *);
@@ -72,6 +76,8 @@ extern bool GOMP_loop_guided_next (long *, long *);
 extern bool GOMP_loop_runtime_next (long *, long *);
 extern bool GOMP_loop_nonmonotonic_dynamic_next (long *, long *);
 extern bool GOMP_loop_nonmonotonic_guided_next (long *, long *);
+extern bool GOMP_loop_nonmonotonic_runtime_next (long *, long *);
+extern bool GOMP_loop_maybe_nonmonotonic_runtime_next (long *, long *);
 
 extern bool GOMP_loop_ordered_static_next (long *, long *);
 extern bool GOMP_loop_ordered_dynamic_next (long *, long *);
@@ -113,6 +119,13 @@ extern void GOMP_parallel_loop_nonmonotonic_dynamic (void (*)(void *), void *,
 extern void GOMP_parallel_loop_nonmonotonic_guided (void (*)(void *), void *,
                                                    unsigned, long, long,
                                                    long, long, unsigned);
+extern void GOMP_parallel_loop_nonmonotonic_runtime (void (*)(void *), void *,
+                                                    unsigned, long, long,
+                                                    long, unsigned);
+extern void GOMP_parallel_loop_maybe_nonmonotonic_runtime (void (*)(void *),
+                                                          void *, unsigned,
+                                                          long, long,
+                                                          long, unsigned);
 
 extern void GOMP_loop_end (void);
 extern void GOMP_loop_end_nowait (void);
@@ -155,6 +168,17 @@ extern bool GOMP_loop_ull_nonmonotonic_guided_start (bool, unsigned long long,
                                                     unsigned long long,
                                                     unsigned long long *,
                                                     unsigned long long *);
+extern bool GOMP_loop_ull_nonmonotonic_runtime_start (bool, unsigned long long,
+                                                     unsigned long long,
+                                                     unsigned long long,
+                                                     unsigned long long *,
+                                                     unsigned long long *);
+extern bool GOMP_loop_ull_maybe_nonmonotonic_runtime_start (bool,
+                                                           unsigned long long,
+                                                           unsigned long long,
+                                                           unsigned long long,
+                                                           unsigned long long *,
+                                                           unsigned long long *);
 
 extern bool GOMP_loop_ull_ordered_static_start (bool, unsigned long long,
                                                unsigned long long,
@@ -192,6 +216,10 @@ extern bool GOMP_loop_ull_nonmonotonic_dynamic_next (unsigned long long *,
                                                     unsigned long long *);
 extern bool GOMP_loop_ull_nonmonotonic_guided_next (unsigned long long *,
                                                    unsigned long long *);
+extern bool GOMP_loop_ull_nonmonotonic_runtime_next (unsigned long long *,
+                                                    unsigned long long *);
+extern bool GOMP_loop_ull_maybe_nonmonotonic_runtime_next (unsigned long long *,
+                                                          unsigned long long *);
 
 extern bool GOMP_loop_ull_ordered_static_next (unsigned long long *,
                                               unsigned long long *);
index 12182e9914e1facb34f84a68c667e3e43a1bf3a2..bafd89a0c20b524544999c87eb30a50b7f079609 100644 (file)
@@ -79,12 +79,12 @@ gomp_loop_init (struct gomp_work_share *ws, long start, long end, long incr,
 }
 
 /* The *_start routines are called when first encountering a loop construct
-   that is not bound directly to a parallel construct.  The first thread 
+   that is not bound directly to a parallel construct.  The first thread
    that arrives will create the work-share construct; subsequent threads
    will see the construct exists and allocate work from it.
 
    START, END, INCR are the bounds of the loop; due to the restrictions of
-   OpenMP, these values must be the same in every thread.  This is not 
+   OpenMP, these values must be the same in every thread.  This is not
    verified (nor is it entirely verifiable, since START is not necessarily
    retained intact in the work-share data structure).  CHUNK_SIZE is the
    scheduling parameter; again this must be identical in all threads.
@@ -174,7 +174,7 @@ GOMP_loop_runtime_start (long start, long end, long incr,
                         long *istart, long *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_static_start (start, end, incr,
@@ -273,7 +273,7 @@ GOMP_loop_ordered_runtime_start (long start, long end, long incr,
                                 long *istart, long *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_ordered_static_start (start, end, incr,
@@ -378,7 +378,7 @@ GOMP_loop_doacross_runtime_start (unsigned ncounts, long *counts,
                                  long *istart, long *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_doacross_static_start (ncounts, counts,
@@ -402,8 +402,8 @@ GOMP_loop_doacross_runtime_start (unsigned ncounts, long *counts,
     }
 }
 
-/* The *_next routines are called when the thread completes processing of 
-   the iteration block currently assigned to it.  If the work-share 
+/* The *_next routines are called when the thread completes processing of
+   the iteration block currently assigned to it.  If the work-share
    construct is bound directly to a parallel construct, then the iteration
    bounds may have been set up before the parallel.  In which case, this
    may be the first iteration for the thread.
@@ -456,7 +456,7 @@ bool
 GOMP_loop_runtime_next (long *istart, long *iend)
 {
   struct gomp_thread *thr = gomp_thread ();
-  
+
   switch (thr->ts.work_share->sched)
     {
     case GFS_STATIC:
@@ -534,7 +534,7 @@ bool
 GOMP_loop_ordered_runtime_next (long *istart, long *iend)
 {
   struct gomp_thread *thr = gomp_thread ();
-  
+
   switch (thr->ts.work_share->sched)
     {
     case GFS_STATIC:
@@ -600,7 +600,8 @@ GOMP_parallel_loop_runtime_start (void (*fn) (void *), void *data,
 {
   struct gomp_task_icv *icv = gomp_icv (false);
   gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
-                           icv->run_sched_var, icv->run_sched_chunk_size, 0);
+                           icv->run_sched_var & ~GFS_MONOTONIC,
+                           icv->run_sched_chunk_size, 0);
 }
 
 ialias_redirect (GOMP_parallel_end)
@@ -638,11 +639,28 @@ GOMP_parallel_loop_guided (void (*fn) (void *), void *data,
   GOMP_parallel_end ();
 }
 
+void
+GOMP_parallel_loop_runtime (void (*fn) (void *), void *data,
+                           unsigned num_threads, long start, long end,
+                           long incr, unsigned flags)
+{
+  struct gomp_task_icv *icv = gomp_icv (false);
+  gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+                           icv->run_sched_var & ~GFS_MONOTONIC,
+                           icv->run_sched_chunk_size, flags);
+  fn (data);
+  GOMP_parallel_end ();
+}
+
 #ifdef HAVE_ATTRIBUTE_ALIAS
 extern __typeof(GOMP_parallel_loop_dynamic) GOMP_parallel_loop_nonmonotonic_dynamic
        __attribute__((alias ("GOMP_parallel_loop_dynamic")));
 extern __typeof(GOMP_parallel_loop_guided) GOMP_parallel_loop_nonmonotonic_guided
        __attribute__((alias ("GOMP_parallel_loop_guided")));
+extern __typeof(GOMP_parallel_loop_runtime) GOMP_parallel_loop_nonmonotonic_runtime
+       __attribute__((alias ("GOMP_parallel_loop_runtime")));
+extern __typeof(GOMP_parallel_loop_runtime) GOMP_parallel_loop_maybe_nonmonotonic_runtime
+       __attribute__((alias ("GOMP_parallel_loop_runtime")));
 #else
 void
 GOMP_parallel_loop_nonmonotonic_dynamic (void (*fn) (void *), void *data,
@@ -667,21 +685,35 @@ GOMP_parallel_loop_nonmonotonic_guided (void (*fn) (void *), void *data,
   fn (data);
   GOMP_parallel_end ();
 }
-#endif
 
 void
-GOMP_parallel_loop_runtime (void (*fn) (void *), void *data,
-                           unsigned num_threads, long start, long end,
-                           long incr, unsigned flags)
+GOMP_parallel_loop_nonmonotonic_runtime (void (*fn) (void *), void *data,
+                                        unsigned num_threads, long start,
+                                        long end, long incr, unsigned flags)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
   gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
-                           icv->run_sched_var, icv->run_sched_chunk_size,
-                           flags);
+                           icv->run_sched_var & ~GFS_MONOTONIC,
+                           icv->run_sched_chunk_size, flags);
   fn (data);
   GOMP_parallel_end ();
 }
 
+void
+GOMP_parallel_loop_maybe_nonmonotonic_runtime (void (*fn) (void *), void *data,
+                                              unsigned num_threads, long start,
+                                              long end, long incr,
+                                              unsigned flags)
+{
+  struct gomp_task_icv *icv = gomp_icv (false);
+  gomp_parallel_loop_start (fn, data, num_threads, start, end, incr,
+                           icv->run_sched_var & ~GFS_MONOTONIC,
+                           icv->run_sched_chunk_size, flags);
+  fn (data);
+  GOMP_parallel_end ();
+}
+#endif
+
 /* The GOMP_loop_end* routines are called after the thread is told that
    all loop iterations are complete.  The first two versions synchronize
    all threads; the nowait version does not.  */
@@ -721,6 +753,10 @@ extern __typeof(gomp_loop_dynamic_start) GOMP_loop_nonmonotonic_dynamic_start
        __attribute__((alias ("gomp_loop_dynamic_start")));
 extern __typeof(gomp_loop_guided_start) GOMP_loop_nonmonotonic_guided_start
        __attribute__((alias ("gomp_loop_guided_start")));
+extern __typeof(GOMP_loop_runtime_start) GOMP_loop_nonmonotonic_runtime_start
+       __attribute__((alias ("GOMP_loop_runtime_start")));
+extern __typeof(GOMP_loop_runtime_start) GOMP_loop_maybe_nonmonotonic_runtime_start
+       __attribute__((alias ("GOMP_loop_runtime_start")));
 
 extern __typeof(gomp_loop_ordered_static_start) GOMP_loop_ordered_static_start
        __attribute__((alias ("gomp_loop_ordered_static_start")));
@@ -746,6 +782,10 @@ extern __typeof(gomp_loop_dynamic_next) GOMP_loop_nonmonotonic_dynamic_next
        __attribute__((alias ("gomp_loop_dynamic_next")));
 extern __typeof(gomp_loop_guided_next) GOMP_loop_nonmonotonic_guided_next
        __attribute__((alias ("gomp_loop_guided_next")));
+extern __typeof(GOMP_loop_runtime_next) GOMP_loop_nonmonotonic_runtime_next
+       __attribute__((alias ("GOMP_loop_runtime_next")));
+extern __typeof(GOMP_loop_runtime_next) GOMP_loop_maybe_nonmonotonic_runtime_next
+       __attribute__((alias ("GOMP_loop_runtime_next")));
 
 extern __typeof(gomp_loop_ordered_static_next) GOMP_loop_ordered_static_next
        __attribute__((alias ("gomp_loop_ordered_static_next")));
@@ -790,6 +830,20 @@ GOMP_loop_nonmonotonic_guided_start (long start, long end, long incr,
   return gomp_loop_guided_start (start, end, incr, chunk_size, istart, iend);
 }
 
+bool
+GOMP_loop_nonmonotonic_runtime_start (long start, long end, long incr,
+                                     long *istart, long *iend)
+{
+  return GOMP_loop_runtime_start (start, end, incr, istart, iend);
+}
+
+bool
+GOMP_loop_maybe_nonmonotonic_runtime_start (long start, long end, long incr,
+                                           long *istart, long *iend)
+{
+  return GOMP_loop_runtime_start (start, end, incr, istart, iend);
+}
+
 bool
 GOMP_loop_ordered_static_start (long start, long end, long incr,
                                long chunk_size, long *istart, long *iend)
@@ -868,6 +922,18 @@ GOMP_loop_nonmonotonic_guided_next (long *istart, long *iend)
   return gomp_loop_guided_next (istart, iend);
 }
 
+bool
+GOMP_loop_nonmonotonic_runtime_next (long *istart, long *iend)
+{
+  return GOMP_loop_runtime_next (istart, iend);
+}
+
+bool
+GOMP_loop_maybe_nonmonotonic_runtime_next (long *istart, long *iend)
+{
+  return GOMP_loop_runtime_next (istart, iend);
+}
+
 bool
 GOMP_loop_ordered_static_next (long *istart, long *iend)
 {
index 3d4ac994f0a9bedef07241d9f2e2bbb2bba2fb9f..7b2dfe6e26b2b444131620e4a0d1c2c39df963bb 100644 (file)
@@ -171,7 +171,7 @@ GOMP_loop_ull_runtime_start (bool up, gomp_ull start, gomp_ull end,
                             gomp_ull incr, gomp_ull *istart, gomp_ull *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_ull_static_start (up, start, end, incr,
@@ -275,7 +275,7 @@ GOMP_loop_ull_ordered_runtime_start (bool up, gomp_ull start, gomp_ull end,
                                     gomp_ull *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_ull_ordered_static_start (up, start, end, incr,
@@ -383,7 +383,7 @@ GOMP_loop_ull_doacross_runtime_start (unsigned ncounts, gomp_ull *counts,
                                      gomp_ull *istart, gomp_ull *iend)
 {
   struct gomp_task_icv *icv = gomp_icv (false);
-  switch (icv->run_sched_var)
+  switch (icv->run_sched_var & ~GFS_MONOTONIC)
     {
     case GFS_STATIC:
       return gomp_loop_ull_doacross_static_start (ncounts, counts,
@@ -570,6 +570,10 @@ extern __typeof(gomp_loop_ull_dynamic_start) GOMP_loop_ull_nonmonotonic_dynamic_
        __attribute__((alias ("gomp_loop_ull_dynamic_start")));
 extern __typeof(gomp_loop_ull_guided_start) GOMP_loop_ull_nonmonotonic_guided_start
        __attribute__((alias ("gomp_loop_ull_guided_start")));
+extern __typeof(GOMP_loop_ull_runtime_start) GOMP_loop_ull_nonmonotonic_runtime_start
+       __attribute__((alias ("GOMP_loop_ull_runtime_start")));
+extern __typeof(GOMP_loop_ull_runtime_start) GOMP_loop_ull_maybe_nonmonotonic_runtime_start
+       __attribute__((alias ("GOMP_loop_ull_runtime_start")));
 
 extern __typeof(gomp_loop_ull_ordered_static_start) GOMP_loop_ull_ordered_static_start
        __attribute__((alias ("gomp_loop_ull_ordered_static_start")));
@@ -595,6 +599,10 @@ extern __typeof(gomp_loop_ull_dynamic_next) GOMP_loop_ull_nonmonotonic_dynamic_n
        __attribute__((alias ("gomp_loop_ull_dynamic_next")));
 extern __typeof(gomp_loop_ull_guided_next) GOMP_loop_ull_nonmonotonic_guided_next
        __attribute__((alias ("gomp_loop_ull_guided_next")));
+extern __typeof(GOMP_loop_ull_runtime_next) GOMP_loop_ull_nonmonotonic_runtime_next
+       __attribute__((alias ("GOMP_loop_ull_runtime_next")));
+extern __typeof(GOMP_loop_ull_runtime_next) GOMP_loop_ull_maybe_nonmonotonic_runtime_next
+       __attribute__((alias ("GOMP_loop_ull_runtime_next")));
 
 extern __typeof(gomp_loop_ull_ordered_static_next) GOMP_loop_ull_ordered_static_next
        __attribute__((alias ("gomp_loop_ull_ordered_static_next")));
@@ -649,6 +657,23 @@ GOMP_loop_ull_nonmonotonic_guided_start (bool up, gomp_ull start, gomp_ull end,
                                     iend);
 }
 
+bool
+GOMP_loop_ull_nonmonotonic_runtime_start (bool up, gomp_ull start,
+                                         gomp_ull end, gomp_ull incr,
+                                         gomp_ull *istart, gomp_ull *iend)
+{
+  return GOMP_loop_ull_runtime_start (up, start, end, incr, istart, iend);
+}
+
+bool
+GOMP_loop_ull_maybe_nonmonotonic_runtime_start (bool up, gomp_ull start,
+                                               gomp_ull end, gomp_ull incr,
+                                               gomp_ull *istart,
+                                               gomp_ull *iend)
+{
+  return GOMP_loop_ull_runtime_start (up, start, end, incr, istart, iend);
+}
+
 bool
 GOMP_loop_ull_ordered_static_start (bool up, gomp_ull start, gomp_ull end,
                                    gomp_ull incr, gomp_ull chunk_size,
@@ -733,6 +758,19 @@ GOMP_loop_ull_nonmonotonic_guided_next (gomp_ull *istart, gomp_ull *iend)
   return gomp_loop_ull_guided_next (istart, iend);
 }
 
+bool
+GOMP_loop_ull_nonmonotonic_runtime_next (gomp_ull *istart, gomp_ull *iend)
+{
+  return GOMP_loop_ull_runtime_next (istart, iend);
+}
+
+bool
+GOMP_loop_ull_maybe_nonmonotonic_runtime_next (gomp_ull *istart,
+                                              gomp_ull *iend)
+{
+  return GOMP_loop_ull_runtime_next (istart, iend);
+}
+
 bool
 GOMP_loop_ull_ordered_static_next (gomp_ull *istart, gomp_ull *iend)
 {
index a9fbd9ec1ce52c3addb6db43c9c2be98e21a81e2..a18303470c010ca18c7f4039525aad2e6da621dd 100644 (file)
@@ -50,7 +50,8 @@ typedef enum omp_sched_t
   omp_sched_static = 1,
   omp_sched_dynamic = 2,
   omp_sched_guided = 3,
-  omp_sched_auto = 4
+  omp_sched_auto = 4,
+  omp_sched_monotonic = 0x80000000U
 } omp_sched_t;
 
 typedef enum omp_proc_bind_t