tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ORDER.
authorJakub Jelinek <jakub@gcc.gnu.org>
Fri, 12 Jul 2019 07:49:51 +0000 (09:49 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 12 Jul 2019 07:49:51 +0000 (09:49 +0200)
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ORDER.
* tree.c (omp_clause_num_ops, omp_clause_code_name): Add
order clause entries.
(walk_tree_1): Handle OMP_CLAUSE_ORDER.
* tree-pretty-print.c (dump_omp_clause): Likewise.
* gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses):
Likewise.
* omp-low.c (scan_sharing_clauses): Likewise.
* tree-nested.c (convert_nonlocal_omp_clauses,
convert_local_omp_clauses): Likewise.
c-family/
* c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ORDER.
* c-omp.c (c_omp_split_clauses): Handle splitting of OMP_CLAUSE_ORDER.
c/
* c-parser.c (c_parser_omp_clause_name): Handle order clause.
(c_parser_omp_clause_order): New function.
(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
(OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
PRAGMA_OMP_CLAUSE_ORDER.
* c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
cp/
* parser.c (cp_parser_omp_clause_name): Handle order clause.
(cp_parser_omp_clause_order): New function.
(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
(OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
PRAGMA_OMP_CLAUSE_ORDER.
* semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
* pt.c (tsubst_omp_clauses): Likewise.
testsuite/
* c-c++-common/gomp/order-1.c: New test.
* c-c++-common/gomp/order-2.c: New test.

From-SVN: r273431

20 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-omp.c
gcc/c-family/c-pragma.h
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/gimplify.c
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/gomp/order-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/order-2.c [new file with mode: 0644]
gcc/tree-core.h
gcc/tree-nested.c
gcc/tree-pretty-print.c
gcc/tree.c

index d4eaa491a10e324ae2cb21f6645da4681cd2829b..34fb0da484617bad143bd7e8bc54c5e866c5a281 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ORDER.
+       * tree.c (omp_clause_num_ops, omp_clause_code_name): Add
+       order clause entries.
+       (walk_tree_1): Handle OMP_CLAUSE_ORDER.
+       * tree-pretty-print.c (dump_omp_clause): Likewise.
+       * gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses):
+       Likewise.
+       * omp-low.c (scan_sharing_clauses): Likewise.
+       * tree-nested.c (convert_nonlocal_omp_clauses,
+       convert_local_omp_clauses): Likewise.
+
 2019-07-12  Kewen Lin  <linkw@gcc.gnu.org>
 
        * gcc/cfgrtl.c (print_rtl_with_bb): Emit a hint if the
index bbad47fc49737d768a34652285252ba70de57483..b84e1f5b9a0da69b7efeb165b675f1708a557000 100644 (file)
@@ -1,7 +1,12 @@
+2019-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ORDER.
+       * c-omp.c (c_omp_split_clauses): Handle splitting of OMP_CLAUSE_ORDER.
+
 2019-07-09  Martin Sebor  <msebor@redhat.com>
 
        PR c++/61339
-       * c-opts.c (handle_deferred_opts): Change class-key of PODs to struct
+       * c-opts.c (handle_deferred_opts): Change class-key of PODs to struct
        and others to class.
        * c-pretty-print.h: Same.
 
index 583305e268b11a1ffcd7560205abfdd789270700..fc08e939651c0d766f50cc9fd0eb7e542b1dc2dc 100644 (file)
@@ -1632,6 +1632,24 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
            }
          s = C_OMP_CLAUSE_SPLIT_PARALLEL;
          break;
+       /* order clauses are allowed on for and simd.  */
+       case OMP_CLAUSE_ORDER:
+         if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
+           {
+             if (code == OMP_SIMD)
+               {
+                 c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
+                                       OMP_CLAUSE_ORDER);
+                 OMP_CLAUSE_CHAIN (c) = cclauses[C_OMP_CLAUSE_SPLIT_FOR];
+                 cclauses[C_OMP_CLAUSE_SPLIT_FOR] = c;
+                 s = C_OMP_CLAUSE_SPLIT_SIMD;
+               }
+             else
+               s = C_OMP_CLAUSE_SPLIT_FOR;
+           }
+         else
+           s = C_OMP_CLAUSE_SPLIT_SIMD;
+         break;
        /* Reduction is allowed on simd, for, parallel, sections, taskloop
           and teams.  Duplicate it on all of them, but omit on for or
           sections if parallel is present (unless inscan, in that case
index ed6503686202cde3687a15897e6315ff3ad2be04..4239adafce260134d225e9031e5017c21dba7d97 100644 (file)
@@ -114,6 +114,7 @@ enum pragma_omp_clause {
   PRAGMA_OMP_CLAUSE_NUM_TASKS,
   PRAGMA_OMP_CLAUSE_NUM_TEAMS,
   PRAGMA_OMP_CLAUSE_NUM_THREADS,
+  PRAGMA_OMP_CLAUSE_ORDER,
   PRAGMA_OMP_CLAUSE_ORDERED,
   PRAGMA_OMP_CLAUSE_PARALLEL,
   PRAGMA_OMP_CLAUSE_PRIORITY,
index bb0573e5401d2f8d3fb70b6553be0686cc8be4a4..c58680c135b541c35ae39299b98c233fe004b117 100644 (file)
@@ -1,3 +1,12 @@
+2019-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-parser.c (c_parser_omp_clause_name): Handle order clause.
+       (c_parser_omp_clause_order): New function.
+       (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
+       (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
+       PRAGMA_OMP_CLAUSE_ORDER.
+       * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
+
 2019-07-10  Richard Biener  <rguenther@suse.de>
 
        * gimple-parser.c (c_parser_gimple_postfix_expression): Support
index 3fa7e682b8fa7c2201647f5ecadc2f8e393f875c..1f83c247160a94d1dc41c67119cce0bc8ecbed37 100644 (file)
@@ -11789,6 +11789,8 @@ c_parser_omp_clause_name (c_parser *parser)
        case 'o':
          if (!strcmp ("ordered", p))
            result = PRAGMA_OMP_CLAUSE_ORDERED;
+         else if (!strcmp ("order", p))
+           result = PRAGMA_OMP_CLAUSE_ORDER;
          break;
        case 'p':
          if (!strcmp ("parallel", p))
@@ -13467,6 +13469,44 @@ c_parser_oacc_clause_wait (c_parser *parser, tree list)
   return list;
 }
 
+
+/* OpenMP 5.0:
+   order ( concurrent ) */
+
+static tree
+c_parser_omp_clause_order (c_parser *parser, tree list)
+{
+  location_t loc = c_parser_peek_token (parser)->location;
+  tree c;
+  const char *p;
+
+  matching_parens parens;
+  if (!parens.require_open (parser))
+    return list;
+  if (!c_parser_next_token_is (parser, CPP_NAME))
+    {
+      c_parser_error (parser, "expected %<concurrent%>");
+      goto out_err;
+    }
+  p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
+  if (strcmp (p, "concurrent") != 0)
+    {
+      c_parser_error (parser, "expected %<concurrent%>");
+      goto out_err;
+    }
+  c_parser_consume_token (parser);
+  parens.skip_until_found_close (parser);
+  /* check_no_duplicate_clause (list, OMP_CLAUSE_ORDER, "order"); */
+  c = build_omp_clause (loc, OMP_CLAUSE_ORDER);
+  OMP_CLAUSE_CHAIN (c) = list;
+  return c;
+
+ out_err:
+  parens.skip_until_found_close (parser);
+  return list;
+}
+
+
 /* OpenMP 2.5:
    ordered
 
@@ -15092,6 +15132,10 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
          clauses = c_parser_omp_clause_num_threads (parser, clauses);
          c_name = "num_threads";
          break;
+       case PRAGMA_OMP_CLAUSE_ORDER:
+         clauses = c_parser_omp_clause_order (parser, clauses);
+         c_name = "order";
+         break;
        case PRAGMA_OMP_CLAUSE_ORDERED:
          clauses = c_parser_omp_clause_ordered (parser, clauses);
          c_name = "ordered";
@@ -17221,7 +17265,8 @@ omp_split_clauses (location_t loc, enum tree_code code,
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION)    \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE)     \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IF)           \
-       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL))
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL)  \
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
 
 static tree
 c_parser_omp_simd (location_t loc, c_parser *parser,
@@ -17277,7 +17322,8 @@ c_parser_omp_simd (location_t loc, c_parser *parser,
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDERED)      \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)     \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE)     \
-       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT)       \
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
 
 static tree
 c_parser_omp_for (location_t loc, c_parser *parser,
index 6419ca985c4655e9f21059477467054e455b6967..e4ce03d9ff5fddce5d90af499c86224e618a69b5 100644 (file)
@@ -13667,6 +13667,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   tree last_iterators = NULL_TREE;
   bool last_iterators_remove = false;
   tree *nogroup_seen = NULL;
+  tree *order_clause = NULL;
   /* 1 if normal/task reduction has been seen, -1 if inscan reduction
      has been seen, -2 if mixed inscan/normal reduction diagnosed.  */
   int reduction_seen = 0;
@@ -14631,6 +14632,25 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          pc = &OMP_CLAUSE_CHAIN (c);
          continue;
 
+       case OMP_CLAUSE_ORDER:
+         if (ordered_clause)
+           {
+             error_at (OMP_CLAUSE_LOCATION (c),
+                       "%<order%> clause must not be used together "
+                       "with %<ordered%>");
+             remove = true;
+             break;
+           }
+         else if (order_clause)
+           {
+             /* Silently remove duplicates.  */
+             remove = true;
+             break;
+           }
+         order_clause = pc;
+         pc = &OMP_CLAUSE_CHAIN (c);
+         continue;
+
        case OMP_CLAUSE_IF:
        case OMP_CLAUSE_NUM_THREADS:
        case OMP_CLAUSE_NUM_TEAMS:
@@ -14683,6 +14703,14 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 
        case OMP_CLAUSE_ORDERED:
          ordered_clause = c;
+         if (order_clause)
+           {
+             error_at (OMP_CLAUSE_LOCATION (*order_clause),
+                       "%<order%> clause must not be used together "
+                       "with %<ordered%>");
+             *order_clause = OMP_CLAUSE_CHAIN (*order_clause);
+             order_clause = NULL;
+           }
          pc = &OMP_CLAUSE_CHAIN (c);
          continue;
 
index bc788c1b446aa8d133a438e67b2ff4d2d62ca971..a18959d6388c6e6fd1f89663635003a2800b2111 100644 (file)
@@ -1,3 +1,13 @@
+2019-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * parser.c (cp_parser_omp_clause_name): Handle order clause.
+       (cp_parser_omp_clause_order): New function.
+       (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ORDER.
+       (OMP_SIMD_CLAUSE_MASK, OMP_FOR_CLAUSE_MASK): Add
+       PRAGMA_OMP_CLAUSE_ORDER.
+       * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ORDER.
+       * pt.c (tsubst_omp_clauses): Likewise.
+
 2019-07-10  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * decl.c (get_type_quals,
index 128141024650e076a4ed9b884796adcca517bec3..c46740a2d104c7184233e6dd69460daad8c6845f 100644 (file)
@@ -32528,6 +32528,8 @@ cp_parser_omp_clause_name (cp_parser *parser)
        case 'o':
          if (!strcmp ("ordered", p))
            result = PRAGMA_OMP_CLAUSE_ORDERED;
+         else if (!strcmp ("order", p))
+           result = PRAGMA_OMP_CLAUSE_ORDER;
          break;
        case 'p':
          if (!strcmp ("parallel", p))
@@ -33919,6 +33921,50 @@ cp_parser_omp_clause_defaultmap (cp_parser *parser, tree list,
   return list;
 }
 
+/* OpenMP 5.0:
+   order ( concurrent ) */
+
+static tree
+cp_parser_omp_clause_order (cp_parser *parser, tree list, location_t location)
+{
+  tree c, id;
+  const char *p;
+
+  matching_parens parens;
+  if (!parens.require_open (parser))
+    return list;
+
+  if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME))
+    {
+      cp_parser_error (parser, "expected %<concurrent%>");
+      goto out_err;
+    }
+  else
+    {
+      id = cp_lexer_peek_token (parser->lexer)->u.value;
+      p = IDENTIFIER_POINTER (id);
+    }
+  if (strcmp (p, "concurrent") != 0)
+    {
+      cp_parser_error (parser, "expected %<concurrent%>");
+      goto out_err;
+    }
+  cp_lexer_consume_token (parser->lexer);
+  if (!parens.require_close (parser))
+    goto out_err;
+
+  /* check_no_duplicate_clause (list, OMP_CLAUSE_ORDER, "order", location); */
+  c = build_omp_clause (location, OMP_CLAUSE_ORDER);
+  OMP_CLAUSE_CHAIN (c) = list;
+  return c;
+
+ out_err:
+  cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
+                                        /*or_comma=*/false,
+                                        /*consume_paren=*/true);
+  return list;
+}
+
 /* OpenMP 2.5:
    ordered
 
@@ -35510,7 +35556,8 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
          c_name = "mergeable";
          break;
        case PRAGMA_OMP_CLAUSE_NOWAIT:
-         clauses = cp_parser_omp_clause_nowait (parser, clauses, token->location);
+         clauses = cp_parser_omp_clause_nowait (parser, clauses,
+                                                token->location);
          c_name = "nowait";
          break;
        case PRAGMA_OMP_CLAUSE_NUM_TASKS:
@@ -35523,6 +35570,11 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
                                                      token->location);
          c_name = "num_threads";
          break;
+       case PRAGMA_OMP_CLAUSE_ORDER:
+         clauses = cp_parser_omp_clause_order (parser, clauses,
+                                               token->location);
+         c_name = "order";
+         break;
        case PRAGMA_OMP_CLAUSE_ORDERED:
          clauses = cp_parser_omp_clause_ordered (parser, clauses,
                                                  token->location);
@@ -37560,7 +37612,8 @@ cp_omp_split_clauses (location_t loc, enum tree_code code,
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION)    \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE)     \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IF)           \
-       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL))
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NONTEMPORAL)  \
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
 
 static tree
 cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
@@ -37620,7 +37673,8 @@ cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDERED)      \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE)     \
        | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT)       \
-       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE))
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE)     \
+       | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
 
 static tree
 cp_parser_omp_for (cp_parser *parser, cp_token *pragma_tok,
index c0a048720019602b07870ef351ca3d57e41684bd..e23c0aaf325a53cb98c1b7b64bc7faec04e4da60 100644 (file)
@@ -16422,6 +16422,7 @@ tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort,
        case OMP_CLAUSE_THREADS:
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_INDEPENDENT:
        case OMP_CLAUSE_AUTO:
        case OMP_CLAUSE_SEQ:
index aadfaffca2adcfeb3a7c3bc61d43cb3fdf3432c7..1a217051263c3a15b3ce8b97d9213c24fbd87745 100644 (file)
@@ -6127,6 +6127,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
   bool branch_seen = false;
   bool copyprivate_seen = false;
   bool ordered_seen = false;
+  bool order_seen = false;
   bool schedule_seen = false;
   bool oacc_async = false;
   tree last_iterators = NULL_TREE;
@@ -7600,6 +7601,13 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
          ordered_seen = true;
          break;
 
+       case OMP_CLAUSE_ORDER:
+         if (order_seen)
+           remove = true;
+         else
+           order_seen = true;
+         break;
+
        case OMP_CLAUSE_INBRANCH:
        case OMP_CLAUSE_NOTINBRANCH:
          if (branch_seen)
@@ -7775,6 +7783,17 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
                      "%<reduction%> clause", "ordered");
          pc = &OMP_CLAUSE_CHAIN (c);
          continue;
+       case OMP_CLAUSE_ORDER:
+         if (ordered_seen)
+           {
+             error_at (OMP_CLAUSE_LOCATION (c),
+                       "%<order%> clause must not be used together "
+                       "with %<ordered%>");
+             *pc = OMP_CLAUSE_CHAIN (c);
+             continue;
+           }
+         pc = &OMP_CLAUSE_CHAIN (c);
+         continue;
        case OMP_CLAUSE_NOWAIT:
          if (copyprivate_seen)
            {
index 146a86ce5883c5faafabfc8120b47573db408268..ca7ad33f867d5ae81de8449e9809c1fc4154c48d 100644 (file)
@@ -9263,6 +9263,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
        case OMP_CLAUSE_NOGROUP:
        case OMP_CLAUSE_THREADS:
        case OMP_CLAUSE_SIMD:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_IF_PRESENT:
        case OMP_CLAUSE_FINALIZE:
          break;
@@ -10223,6 +10224,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_HINT:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_USE_DEVICE_PTR:
        case OMP_CLAUSE_IS_DEVICE_PTR:
        case OMP_CLAUSE_ASYNC:
index a855c5b2f8b959e861ff5137ac0ff7d8c8ccc4b6..052ffc9c3b9e2770955a008a6b1c971d17496443 100644 (file)
@@ -1402,6 +1402,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_NOGROUP:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_ASYNC:
        case OMP_CLAUSE_WAIT:
        case OMP_CLAUSE_GANG:
@@ -1595,6 +1596,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_NOGROUP:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_USE_DEVICE_PTR:
        case OMP_CLAUSE_NONTEMPORAL:
        case OMP_CLAUSE_ASYNC:
index 6c40496db9c364b15b0ae1fea1eefe09c47ac4ab..ed3165ee4a5382786a64daf9b86c09a542e6b763 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-12  Jakub Jelinek  <jakub@redhat.com>
+
+       * c-c++-common/gomp/order-1.c: New test.
+       * c-c++-common/gomp/order-2.c: New test.
+
 2019-07-11  Sunil K Pandey  <sunil.k.pandey@intel.com>
 
        PR target/90980
diff --git a/gcc/testsuite/c-c++-common/gomp/order-1.c b/gcc/testsuite/c-c++-common/gomp/order-1.c
new file mode 100644 (file)
index 0000000..da4b73d
--- /dev/null
@@ -0,0 +1,53 @@
+void
+f1 (int *a)
+{
+  int i;
+  #pragma omp for order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp simd order ( concurrent )
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp for simd order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+}
+
+void
+f2 (int *a)
+{
+  int i;
+  #pragma omp parallel for order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp parallel for simd order (concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp teams distribute parallel for order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp teams distribute parallel for simd order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp teams
+  {
+    #pragma omp distribute parallel for order(concurrent)
+    for (i = 0; i < 128; i++)
+      a[i]++;
+    #pragma omp distribute parallel for simd order(concurrent)
+    for (i = 0; i < 128; i++)
+      a[i]++;
+  }
+  #pragma omp taskloop simd order (concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+}
+
+void
+f3 (int *a)
+{
+  int i;
+  #pragma omp for order(concurrent) order(concurrent) order(concurrent)
+  for (i = 0; i < 128; i++)
+    a[i]++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/order-2.c b/gcc/testsuite/c-c++-common/gomp/order-2.c
new file mode 100644 (file)
index 0000000..1a9adb0
--- /dev/null
@@ -0,0 +1,57 @@
+void
+f1 (int *a)
+{
+  int i;
+  #pragma omp for order                                /* { dg-error "expected" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp for simd order :                 /* { dg-error "expected" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp simd order ( foobar )            /* { dg-error "expected" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp for simd order( concurrent       /* { dg-error "expected" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp for simd order( concurrent : foo )/* { dg-error "expected" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+}
+
+void
+f2 (int *a)
+{
+  int i;
+  #pragma omp teams
+  #pragma omp distribute order(concurrent)     /* { dg-error "'order' is not valid for '#pragma omp distribute'" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp taskloop order (concurrent)      /* { dg-error "'order' is not valid for '#pragma omp taskloop'" } */
+  for (i = 0; i < 128; i++)
+    a[i]++;
+  #pragma omp for order(concurrent) ordered    /* { dg-error "'order' clause must not be used together with 'ordered'" } */
+  for (i = 0; i < 128; i++)
+    {
+      #pragma omp ordered
+      a[i]++;
+    }
+  #pragma omp for ordered order(concurrent)    /* { dg-error "'order' clause must not be used together with 'ordered'" } */
+  for (i = 0; i < 128; i++)
+    {
+      #pragma omp ordered
+      a[i]++;
+    }
+  #pragma omp for ordered (1) order(concurrent)        /* { dg-error "'order' clause must not be used together with 'ordered'" } */
+  for (i = 0; i < 128; i++)
+    {
+      #pragma omp ordered depend (sink: i - 1)
+      #pragma omp ordered depend (source)
+    }
+  #pragma omp for order(concurrent)ordered (1) /* { dg-error "'order' clause must not be used together with 'ordered'" } */
+  for (i = 0; i < 128; i++)
+    {
+      #pragma omp ordered depend (sink: i - 1)
+      #pragma omp ordered depend (source)
+    }
+}
index b5dde47da4f29b2590b379400842a98c489398ee..8ac07e83b120a9e8d612312950e9b5b0af7e44cb 100644 (file)
@@ -448,6 +448,9 @@ enum omp_clause_code {
   /* OpenMP clause: defaultmap (tofrom: scalar).  */
   OMP_CLAUSE_DEFAULTMAP,
 
+  /* OpenMP clause: order (concurrent).  */
+  OMP_CLAUSE_ORDER,
+
   /* Internally used only clause, holding SIMD uid.  */
   OMP_CLAUSE__SIMDUID_,
 
index e703cd982a6c1afe9e89f0da639d2d89b850b668..1527456e0c572f59733205e97dcc325ba8d2a253 100644 (file)
@@ -1343,6 +1343,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
        case OMP_CLAUSE_THREADS:
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_SEQ:
        case OMP_CLAUSE_INDEPENDENT:
        case OMP_CLAUSE_AUTO:
@@ -2073,6 +2074,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
        case OMP_CLAUSE_THREADS:
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_SEQ:
        case OMP_CLAUSE_INDEPENDENT:
        case OMP_CLAUSE_AUTO:
index 742c2840cd530551af26fd4345317f22d7787aee..a75f97aa72190a07fdca33688af4483c8b815c1c 100644 (file)
@@ -1040,6 +1040,10 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
       pp_right_paren (pp);
       break;
 
+    case OMP_CLAUSE_ORDER:
+      pp_string (pp, "order(concurrent)");
+      break;
+
     case OMP_CLAUSE__SIMDUID_:
       pp_string (pp, "_simduid_(");
       dump_generic_node (pp, OMP_CLAUSE__SIMDUID__DECL (clause),
index a6099639fb0ea9ccab631b7fdcfd1862a1f596a3..751370b903c95cbe3ad4631da5989f51d3e52849 100644 (file)
@@ -342,7 +342,8 @@ unsigned const char omp_clause_num_ops[] =
   0, /* OMP_CLAUSE_THREADS  */
   0, /* OMP_CLAUSE_SIMD  */
   1, /* OMP_CLAUSE_HINT  */
-  0, /* OMP_CLAUSE_DEFALTMAP  */
+  0, /* OMP_CLAUSE_DEFAULTMAP  */
+  0, /* OMP_CLAUSE_ORDER  */
   1, /* OMP_CLAUSE__SIMDUID_  */
   0, /* OMP_CLAUSE__SIMT_  */
   0, /* OMP_CLAUSE_INDEPENDENT  */
@@ -424,6 +425,7 @@ const char * const omp_clause_code_name[] =
   "simd",
   "hint",
   "defaultmap",
+  "order",
   "_simduid_",
   "_simt_",
   "independent",
@@ -12340,6 +12342,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
        case OMP_CLAUSE_THREADS:
        case OMP_CLAUSE_SIMD:
        case OMP_CLAUSE_DEFAULTMAP:
+       case OMP_CLAUSE_ORDER:
        case OMP_CLAUSE_AUTO:
        case OMP_CLAUSE_SEQ:
        case OMP_CLAUSE_TILE: