* 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
+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
+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.
}
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
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,
+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
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))
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
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";
| (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,
| (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,
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;
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:
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;
+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,
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))
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
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:
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);
| (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,
| (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,
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:
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;
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)
"%<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)
{
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;
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:
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:
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:
+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
--- /dev/null
+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]++;
+}
--- /dev/null
+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)
+ }
+}
/* 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_,
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:
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:
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),
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 */
"simd",
"hint",
"defaultmap",
+ "order",
"_simduid_",
"_simt_",
"independent",
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: