case OMP_LIST_MAP: type = "MAP"; break;
case OMP_LIST_TO: type = "TO"; break;
case OMP_LIST_FROM: type = "FROM"; break;
- case OMP_LIST_REDUCTION: type = "REDUCTION"; break;
+ case OMP_LIST_REDUCTION:
+ case OMP_LIST_REDUCTION_INSCAN:
+ case OMP_LIST_REDUCTION_TASK: type = "REDUCTION"; break;
+ case OMP_LIST_IN_REDUCTION: type = "IN_REDUCTION"; break;
+ case OMP_LIST_TASK_REDUCTION: type = "TASK_REDUCTION"; break;
case OMP_LIST_DEVICE_RESIDENT: type = "DEVICE_RESIDENT"; break;
case OMP_LIST_LINK: type = "LINK"; break;
case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break;
gcc_unreachable ();
}
fprintf (dumpfile, " %s(", type);
+ if (list_type == OMP_LIST_REDUCTION_INSCAN)
+ fputs ("inscan, ", dumpfile);
+ if (list_type == OMP_LIST_REDUCTION_TASK)
+ fputs ("task, ", dumpfile);
show_omp_namelist (list_type, omp_clauses->lists[list_type]);
fputc (')', dumpfile);
}
OMP_LIST_TO,
OMP_LIST_FROM,
OMP_LIST_REDUCTION,
+ OMP_LIST_REDUCTION_INSCAN,
+ OMP_LIST_REDUCTION_TASK,
+ OMP_LIST_IN_REDUCTION,
+ OMP_LIST_TASK_REDUCTION,
OMP_LIST_DEVICE_RESIDENT,
OMP_LIST_LINK,
OMP_LIST_USE_DEVICE,
OMP_CLAUSE_SHARED,
OMP_CLAUSE_COPYIN,
OMP_CLAUSE_REDUCTION,
+ OMP_CLAUSE_IN_REDUCTION,
+ OMP_CLAUSE_TASK_REDUCTION,
OMP_CLAUSE_IF,
OMP_CLAUSE_NUM_THREADS,
OMP_CLAUSE_SCHEDULE,
return false;
}
+/* reduction ( reduction-modifier, reduction-operator : variable-list )
+ in_reduction ( reduction-operator : variable-list )
+ task_reduction ( reduction-operator : variable-list ) */
+
+static match
+gfc_match_omp_clause_reduction (char pc, gfc_omp_clauses *c, bool openacc,
+ bool allow_derived)
+{
+ if (pc == 'r' && gfc_match ("reduction ( ") != MATCH_YES)
+ return MATCH_NO;
+ else if (pc == 'i' && gfc_match ("in_reduction ( ") != MATCH_YES)
+ return MATCH_NO;
+ else if (pc == 't' && gfc_match ("task_reduction ( ") != MATCH_YES)
+ return MATCH_NO;
+
+ locus old_loc = gfc_current_locus;
+ int list_idx = 0;
+
+ if (pc == 'r' && !openacc)
+ {
+ if (gfc_match ("inscan") == MATCH_YES)
+ list_idx = OMP_LIST_REDUCTION_INSCAN;
+ else if (gfc_match ("task") == MATCH_YES)
+ list_idx = OMP_LIST_REDUCTION_TASK;
+ else if (gfc_match ("default") == MATCH_YES)
+ list_idx = OMP_LIST_REDUCTION;
+ if (list_idx != 0 && gfc_match (", ") != MATCH_YES)
+ {
+ gfc_error ("Comma expected at %C");
+ gfc_current_locus = old_loc;
+ return MATCH_NO;
+ }
+ if (list_idx == 0)
+ list_idx = OMP_LIST_REDUCTION;
+ }
+ else if (pc == 'i')
+ list_idx = OMP_LIST_IN_REDUCTION;
+ else if (pc == 't')
+ list_idx = OMP_LIST_TASK_REDUCTION;
+ else
+ list_idx = OMP_LIST_REDUCTION;
+
+ gfc_omp_reduction_op rop = OMP_REDUCTION_NONE;
+ char buffer[GFC_MAX_SYMBOL_LEN + 3];
+ if (gfc_match_char ('+') == MATCH_YES)
+ rop = OMP_REDUCTION_PLUS;
+ else if (gfc_match_char ('*') == MATCH_YES)
+ rop = OMP_REDUCTION_TIMES;
+ else if (gfc_match_char ('-') == MATCH_YES)
+ rop = OMP_REDUCTION_MINUS;
+ else if (gfc_match (".and.") == MATCH_YES)
+ rop = OMP_REDUCTION_AND;
+ else if (gfc_match (".or.") == MATCH_YES)
+ rop = OMP_REDUCTION_OR;
+ else if (gfc_match (".eqv.") == MATCH_YES)
+ rop = OMP_REDUCTION_EQV;
+ else if (gfc_match (".neqv.") == MATCH_YES)
+ rop = OMP_REDUCTION_NEQV;
+ if (rop != OMP_REDUCTION_NONE)
+ snprintf (buffer, sizeof buffer, "operator %s",
+ gfc_op2string ((gfc_intrinsic_op) rop));
+ else if (gfc_match_defined_op_name (buffer + 1, 1) == MATCH_YES)
+ {
+ buffer[0] = '.';
+ strcat (buffer, ".");
+ }
+ else if (gfc_match_name (buffer) == MATCH_YES)
+ {
+ gfc_symbol *sym;
+ const char *n = buffer;
+
+ gfc_find_symbol (buffer, NULL, 1, &sym);
+ if (sym != NULL)
+ {
+ if (sym->attr.intrinsic)
+ n = sym->name;
+ else if ((sym->attr.flavor != FL_UNKNOWN
+ && sym->attr.flavor != FL_PROCEDURE)
+ || sym->attr.external
+ || sym->attr.generic
+ || sym->attr.entry
+ || sym->attr.result
+ || sym->attr.dummy
+ || sym->attr.subroutine
+ || sym->attr.pointer
+ || sym->attr.target
+ || sym->attr.cray_pointer
+ || sym->attr.cray_pointee
+ || (sym->attr.proc != PROC_UNKNOWN
+ && sym->attr.proc != PROC_INTRINSIC)
+ || sym->attr.if_source != IFSRC_UNKNOWN
+ || sym == sym->ns->proc_name)
+ {
+ sym = NULL;
+ n = NULL;
+ }
+ else
+ n = sym->name;
+ }
+ if (n == NULL)
+ rop = OMP_REDUCTION_NONE;
+ else if (strcmp (n, "max") == 0)
+ rop = OMP_REDUCTION_MAX;
+ else if (strcmp (n, "min") == 0)
+ rop = OMP_REDUCTION_MIN;
+ else if (strcmp (n, "iand") == 0)
+ rop = OMP_REDUCTION_IAND;
+ else if (strcmp (n, "ior") == 0)
+ rop = OMP_REDUCTION_IOR;
+ else if (strcmp (n, "ieor") == 0)
+ rop = OMP_REDUCTION_IEOR;
+ if (rop != OMP_REDUCTION_NONE
+ && sym != NULL
+ && ! sym->attr.intrinsic
+ && ! sym->attr.use_assoc
+ && ((sym->attr.flavor == FL_UNKNOWN
+ && !gfc_add_flavor (&sym->attr, FL_PROCEDURE,
+ sym->name, NULL))
+ || !gfc_add_intrinsic (&sym->attr, NULL)))
+ rop = OMP_REDUCTION_NONE;
+ }
+ else
+ buffer[0] = '\0';
+ gfc_omp_udr *udr = (buffer[0] ? gfc_find_omp_udr (gfc_current_ns, buffer, NULL)
+ : NULL);
+ gfc_omp_namelist **head = NULL;
+ if (rop == OMP_REDUCTION_NONE && udr)
+ rop = OMP_REDUCTION_USER;
+
+ if (gfc_match_omp_variable_list (" :", &c->lists[list_idx], false, NULL,
+ &head, openacc, allow_derived) != MATCH_YES)
+ {
+ gfc_current_locus = old_loc;
+ return MATCH_NO;
+ }
+ gfc_omp_namelist *n;
+ if (rop == OMP_REDUCTION_NONE)
+ {
+ n = *head;
+ *head = NULL;
+ gfc_error_now ("!$OMP DECLARE REDUCTION %s not found at %L",
+ buffer, &old_loc);
+ gfc_free_omp_namelist (n);
+ }
+ else
+ for (n = *head; n; n = n->next)
+ {
+ n->u.reduction_op = rop;
+ if (udr)
+ {
+ n->udr = gfc_get_omp_namelist_udr ();
+ n->udr->udr = udr;
+ }
+ }
+ return MATCH_YES;
+}
+
/* Match OpenMP and OpenACC directive clauses. MASK is a bitmask of
clauses that are allowed for a particular directive. */
needs_space = true;
continue;
}
+ if ((mask & OMP_CLAUSE_IN_REDUCTION)
+ && gfc_match_omp_clause_reduction (pc, c, openacc,
+ allow_derived) == MATCH_YES)
+ continue;
if ((mask & OMP_CLAUSE_INBRANCH)
&& !c->inbranch
&& !c->notinbranch
continue;
}
if ((mask & OMP_CLAUSE_REDUCTION)
- && gfc_match ("reduction ( ") == MATCH_YES)
+ && gfc_match_omp_clause_reduction (pc, c, openacc,
+ allow_derived) == MATCH_YES)
+ continue;
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("relaxed") == MATCH_YES)
{
- gfc_omp_reduction_op rop = OMP_REDUCTION_NONE;
- char buffer[GFC_MAX_SYMBOL_LEN + 3];
- if (gfc_match_char ('+') == MATCH_YES)
- rop = OMP_REDUCTION_PLUS;
- else if (gfc_match_char ('*') == MATCH_YES)
- rop = OMP_REDUCTION_TIMES;
- else if (gfc_match_char ('-') == MATCH_YES)
- rop = OMP_REDUCTION_MINUS;
- else if (gfc_match (".and.") == MATCH_YES)
- rop = OMP_REDUCTION_AND;
- else if (gfc_match (".or.") == MATCH_YES)
- rop = OMP_REDUCTION_OR;
- else if (gfc_match (".eqv.") == MATCH_YES)
- rop = OMP_REDUCTION_EQV;
- else if (gfc_match (".neqv.") == MATCH_YES)
- rop = OMP_REDUCTION_NEQV;
- if (rop != OMP_REDUCTION_NONE)
- snprintf (buffer, sizeof buffer, "operator %s",
- gfc_op2string ((gfc_intrinsic_op) rop));
- else if (gfc_match_defined_op_name (buffer + 1, 1) == MATCH_YES)
- {
- buffer[0] = '.';
- strcat (buffer, ".");
- }
- else if (gfc_match_name (buffer) == MATCH_YES)
- {
- gfc_symbol *sym;
- const char *n = buffer;
-
- gfc_find_symbol (buffer, NULL, 1, &sym);
- if (sym != NULL)
- {
- if (sym->attr.intrinsic)
- n = sym->name;
- else if ((sym->attr.flavor != FL_UNKNOWN
- && sym->attr.flavor != FL_PROCEDURE)
- || sym->attr.external
- || sym->attr.generic
- || sym->attr.entry
- || sym->attr.result
- || sym->attr.dummy
- || sym->attr.subroutine
- || sym->attr.pointer
- || sym->attr.target
- || sym->attr.cray_pointer
- || sym->attr.cray_pointee
- || (sym->attr.proc != PROC_UNKNOWN
- && sym->attr.proc != PROC_INTRINSIC)
- || sym->attr.if_source != IFSRC_UNKNOWN
- || sym == sym->ns->proc_name)
- {
- sym = NULL;
- n = NULL;
- }
- else
- n = sym->name;
- }
- if (n == NULL)
- rop = OMP_REDUCTION_NONE;
- else if (strcmp (n, "max") == 0)
- rop = OMP_REDUCTION_MAX;
- else if (strcmp (n, "min") == 0)
- rop = OMP_REDUCTION_MIN;
- else if (strcmp (n, "iand") == 0)
- rop = OMP_REDUCTION_IAND;
- else if (strcmp (n, "ior") == 0)
- rop = OMP_REDUCTION_IOR;
- else if (strcmp (n, "ieor") == 0)
- rop = OMP_REDUCTION_IEOR;
- if (rop != OMP_REDUCTION_NONE
- && sym != NULL
- && ! sym->attr.intrinsic
- && ! sym->attr.use_assoc
- && ((sym->attr.flavor == FL_UNKNOWN
- && !gfc_add_flavor (&sym->attr, FL_PROCEDURE,
- sym->name, NULL))
- || !gfc_add_intrinsic (&sym->attr, NULL)))
- rop = OMP_REDUCTION_NONE;
- }
- else
- buffer[0] = '\0';
- gfc_omp_udr *udr
- = (buffer[0]
- ? gfc_find_omp_udr (gfc_current_ns, buffer, NULL) : NULL);
- gfc_omp_namelist **head = NULL;
- if (rop == OMP_REDUCTION_NONE && udr)
- rop = OMP_REDUCTION_USER;
-
- if (gfc_match_omp_variable_list (" :",
- &c->lists[OMP_LIST_REDUCTION],
- false, NULL, &head, openacc,
- allow_derived) == MATCH_YES)
- {
- gfc_omp_namelist *n;
- if (rop == OMP_REDUCTION_NONE)
- {
- n = *head;
- *head = NULL;
- gfc_error_now ("!$OMP DECLARE REDUCTION %s not found "
- "at %L", buffer, &old_loc);
- gfc_free_omp_namelist (n);
- }
- else
- for (n = *head; n; n = n->next)
- {
- n->u.reduction_op = rop;
- if (udr)
- {
- n->udr = gfc_get_omp_namelist_udr ();
- n->udr->udr = udr;
- }
- }
- continue;
- }
- else
- gfc_current_locus = old_loc;
+ c->memorder = OMP_MEMORDER_RELAXED;
+ needs_space = true;
+ continue;
+ }
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("release") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_RELEASE;
+ needs_space = true;
+ continue;
}
if ((mask & OMP_CLAUSE_MEMORDER)
&& c->memorder == OMP_MEMORDER_UNSET
}
break;
case 't':
+ if ((mask & OMP_CLAUSE_TASK_REDUCTION)
+ && gfc_match_omp_clause_reduction (pc, c, openacc,
+ allow_derived) == MATCH_YES)
+ continue;
if ((mask & OMP_CLAUSE_THREAD_LIMIT)
&& c->thread_limit == NULL
&& gfc_match ("thread_limit ( %e )",
(omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_FIRSTPRIVATE \
| OMP_CLAUSE_SHARED | OMP_CLAUSE_IF | OMP_CLAUSE_DEFAULT \
| OMP_CLAUSE_UNTIED | OMP_CLAUSE_FINAL | OMP_CLAUSE_MERGEABLE \
- | OMP_CLAUSE_DEPEND | OMP_CLAUSE_PRIORITY)
+ | OMP_CLAUSE_DEPEND | OMP_CLAUSE_PRIORITY | OMP_CLAUSE_IN_REDUCTION)
#define OMP_TASKLOOP_CLAUSES \
(omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_FIRSTPRIVATE \
| OMP_CLAUSE_LASTPRIVATE | OMP_CLAUSE_SHARED | OMP_CLAUSE_IF \
| OMP_CLAUSE_DEFAULT | OMP_CLAUSE_UNTIED | OMP_CLAUSE_FINAL \
| OMP_CLAUSE_MERGEABLE | OMP_CLAUSE_PRIORITY | OMP_CLAUSE_GRAINSIZE \
- | OMP_CLAUSE_NUM_TASKS | OMP_CLAUSE_COLLAPSE | OMP_CLAUSE_NOGROUP)
+ | OMP_CLAUSE_NUM_TASKS | OMP_CLAUSE_COLLAPSE | OMP_CLAUSE_NOGROUP \
+ | OMP_CLAUSE_REDUCTION | OMP_CLAUSE_IN_REDUCTION)
#define OMP_TARGET_CLAUSES \
(omp_mask (OMP_CLAUSE_DEVICE) | OMP_CLAUSE_MAP | OMP_CLAUSE_IF \
| OMP_CLAUSE_DEPEND | OMP_CLAUSE_NOWAIT | OMP_CLAUSE_PRIVATE \
| OMP_CLAUSE_FIRSTPRIVATE | OMP_CLAUSE_DEFAULTMAP \
- | OMP_CLAUSE_IS_DEVICE_PTR)
+ | OMP_CLAUSE_IS_DEVICE_PTR | OMP_CLAUSE_IN_REDUCTION)
#define OMP_TARGET_DATA_CLAUSES \
(omp_mask (OMP_CLAUSE_DEVICE) | OMP_CLAUSE_MAP | OMP_CLAUSE_IF \
| OMP_CLAUSE_USE_DEVICE_PTR | OMP_CLAUSE_USE_DEVICE_ADDR)
match
gfc_match_omp_taskgroup (void)
{
- if (gfc_match_omp_eos () != MATCH_YES)
- {
- gfc_error ("Unexpected junk after $OMP TASKGROUP statement at %C");
- return MATCH_ERROR;
- }
+ gfc_omp_clauses *c;
+ if (gfc_match_omp_clauses (&c, OMP_CLAUSE_TASK_REDUCTION, true, true)
+ != MATCH_YES)
+ return MATCH_ERROR;
new_st.op = EXEC_OMP_TASKGROUP;
+ new_st.ext.omp_clauses = c;
return MATCH_YES;
}
static const char *clause_names[]
= { "PRIVATE", "FIRSTPRIVATE", "LASTPRIVATE", "COPYPRIVATE", "SHARED",
"COPYIN", "UNIFORM", "ALIGNED", "LINEAR", "DEPEND", "MAP",
- "TO", "FROM", "REDUCTION", "DEVICE_RESIDENT", "LINK", "USE_DEVICE",
+ "TO", "FROM", "REDUCTION", "REDUCTION" /*inscan*/, "REDUCTION" /*task*/,
+ "IN_REDUCTION", "TASK_REDUCTION",
+ "DEVICE_RESIDENT", "LINK", "USE_DEVICE",
"CACHE", "IS_DEVICE_PTR", "USE_DEVICE_PTR", "USE_DEVICE_ADDR",
"NONTEMPORAL" };
STATIC_ASSERT (ARRAY_SIZE (clause_names) == OMP_LIST_NUM);
if (omp_clauses->sched_kind != OMP_SCHED_NONE
&& omp_clauses->sched_nonmonotonic)
{
- if (omp_clauses->sched_kind != OMP_SCHED_DYNAMIC
- && omp_clauses->sched_kind != OMP_SCHED_GUIDED)
- {
- const char *p;
- switch (omp_clauses->sched_kind)
- {
- case OMP_SCHED_STATIC: p = "STATIC"; break;
- case OMP_SCHED_RUNTIME: p = "RUNTIME"; break;
- case OMP_SCHED_AUTO: p = "AUTO"; break;
- default: gcc_unreachable ();
- }
- gfc_error ("NONMONOTONIC modifier specified for %s schedule kind "
- "at %L", p, &code->loc);
- }
- else if (omp_clauses->sched_monotonic)
+ if (omp_clauses->sched_monotonic)
gfc_error ("Both MONOTONIC and NONMONOTONIC schedule modifiers "
"specified at %L", &code->loc);
else if (omp_clauses->ordered)
&& (list != OMP_LIST_MAP || openacc)
&& list != OMP_LIST_FROM
&& list != OMP_LIST_TO
- && (list != OMP_LIST_REDUCTION || !openacc))
+ && (list != OMP_LIST_REDUCTION || !openacc)
+ && list != OMP_LIST_REDUCTION_INSCAN
+ && list != OMP_LIST_REDUCTION_TASK
+ && list != OMP_LIST_IN_REDUCTION
+ && list != OMP_LIST_TASK_REDUCTION)
for (n = omp_clauses->lists[list]; n; n = n->next)
{
bool component_ref_p = false;
for (; n != NULL; n = n->next)
{
bool bad = false;
+ bool is_reduction = (list == OMP_LIST_REDUCTION
+ || list == OMP_LIST_REDUCTION_INSCAN
+ || list == OMP_LIST_REDUCTION_TASK
+ || list == OMP_LIST_IN_REDUCTION
+ || list == OMP_LIST_TASK_REDUCTION);
if (n->sym->attr.threadprivate)
gfc_error ("THREADPRIVATE object %qs in %s clause at %L",
n->sym->name, name, &n->where);
if (n->sym->attr.associate_var)
gfc_error ("ASSOCIATE name %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (list != OMP_LIST_PRIVATE)
+ if (list != OMP_LIST_PRIVATE && is_reduction)
{
- if (n->sym->attr.proc_pointer && list == OMP_LIST_REDUCTION)
+ if (n->sym->attr.proc_pointer)
gfc_error ("Procedure pointer %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (n->sym->attr.pointer && list == OMP_LIST_REDUCTION)
+ if (n->sym->attr.pointer)
gfc_error ("POINTER object %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (n->sym->attr.cray_pointer && list == OMP_LIST_REDUCTION)
+ if (n->sym->attr.cray_pointer)
gfc_error ("Cray pointer %qs in %s clause at %L",
n->sym->name, name, &n->where);
}
else if (n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array %qs in %s clause at %L",
n->sym->name, name, &n->where);
- if (n->sym->attr.in_namelist && list != OMP_LIST_REDUCTION)
+ if (n->sym->attr.in_namelist && !is_reduction)
gfc_error ("Variable %qs in %s clause is used in "
"NAMELIST statement at %L",
n->sym->name, name, &n->where);
switch (list)
{
+ case OMP_LIST_REDUCTION_INSCAN:
+ case OMP_LIST_REDUCTION_TASK:
+ if (code && (code->op == EXEC_OMP_TASKLOOP
+ || code->op == EXEC_OMP_TEAMS
+ || code->op == EXEC_OMP_TEAMS_DISTRIBUTE))
+ {
+ gfc_error ("Only DEFAULT permitted as reduction-"
+ "modifier in REDUCTION clause at %L",
+ &n->where);
+ break;
+ }
+ gcc_fallthrough ();
case OMP_LIST_REDUCTION:
+ case OMP_LIST_IN_REDUCTION:
+ case OMP_LIST_TASK_REDUCTION:
switch (n->u.reduction_op)
{
case OMP_REDUCTION_PLUS:
case OMP_LIST_FIRSTPRIVATE:
case OMP_LIST_LASTPRIVATE:
case OMP_LIST_REDUCTION:
+ case OMP_LIST_REDUCTION_INSCAN:
+ case OMP_LIST_REDUCTION_TASK:
+ case OMP_LIST_IN_REDUCTION:
+ case OMP_LIST_TASK_REDUCTION:
case OMP_LIST_LINEAR:
for (n = omp_clauses->lists[list]; n; n = n->next)
ctx.sharing_clauses->add (n->sym);
case OMP_CLAUSE_LASTPRIVATE:
case OMP_CLAUSE_LINEAR:
case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_IN_REDUCTION:
+ case OMP_CLAUSE_TASK_REDUCTION:
break;
default:
gcc_unreachable ();
then_b = gfc_finish_block (&cond_block);
/* Reduction clause requires allocated ALLOCATABLE. */
- if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_REDUCTION)
+ if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_IN_REDUCTION
+ && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_TASK_REDUCTION)
{
gfc_init_block (&cond_block);
if (GFC_DESCRIPTOR_TYPE_P (type))
}
static tree
-gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list,
+gfc_trans_omp_reduction_list (int kind, gfc_omp_namelist *namelist, tree list,
locus where, bool mark_addressable)
{
+ omp_clause_code clause = OMP_CLAUSE_REDUCTION;
+ switch (kind)
+ {
+ case OMP_LIST_REDUCTION:
+ case OMP_LIST_REDUCTION_INSCAN:
+ case OMP_LIST_REDUCTION_TASK:
+ break;
+ case OMP_LIST_IN_REDUCTION:
+ clause = OMP_CLAUSE_IN_REDUCTION;
+ break;
+ case OMP_LIST_TASK_REDUCTION:
+ clause = OMP_CLAUSE_TASK_REDUCTION;
+ break;
+ default:
+ gcc_unreachable ();
+ }
for (; namelist != NULL; namelist = namelist->next)
if (namelist->sym->attr.referenced)
{
if (t != error_mark_node)
{
tree node = build_omp_clause (gfc_get_location (&namelist->where),
- OMP_CLAUSE_REDUCTION);
+ clause);
OMP_CLAUSE_DECL (node) = t;
if (mark_addressable)
TREE_ADDRESSABLE (t) = 1;
+ if (kind == OMP_LIST_REDUCTION_INSCAN)
+ OMP_CLAUSE_REDUCTION_INSCAN (node) = 1;
+ if (kind == OMP_LIST_REDUCTION_TASK)
+ OMP_CLAUSE_REDUCTION_TASK (node) = 1;
switch (namelist->u.reduction_op)
{
case OMP_REDUCTION_PLUS:
switch (list)
{
case OMP_LIST_REDUCTION:
+ case OMP_LIST_REDUCTION_INSCAN:
+ case OMP_LIST_REDUCTION_TASK:
+ case OMP_LIST_IN_REDUCTION:
+ case OMP_LIST_TASK_REDUCTION:
/* An OpenACC async clause indicates the need to set reduction
arguments addressable, to allow asynchronous copy-out. */
- omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where,
- clauses->async);
+ omp_clauses = gfc_trans_omp_reduction_list (list, n, omp_clauses,
+ where, clauses->async);
break;
case OMP_LIST_PRIVATE:
clause_code = OMP_CLAUSE_PRIVATE;
/* Reduction is allowed on simd, do, parallel and teams.
Duplicate it on all of them, but omit on do if
parallel is present. */
- if (mask & GFC_OMP_MASK_TEAMS)
- clausesa[GFC_OMP_SPLIT_TEAMS].lists[OMP_LIST_REDUCTION]
- = code->ext.omp_clauses->lists[OMP_LIST_REDUCTION];
- if (mask & GFC_OMP_MASK_PARALLEL)
- clausesa[GFC_OMP_SPLIT_PARALLEL].lists[OMP_LIST_REDUCTION]
- = code->ext.omp_clauses->lists[OMP_LIST_REDUCTION];
- else if (mask & GFC_OMP_MASK_DO)
- clausesa[GFC_OMP_SPLIT_DO].lists[OMP_LIST_REDUCTION]
- = code->ext.omp_clauses->lists[OMP_LIST_REDUCTION];
- if (mask & GFC_OMP_MASK_SIMD)
- clausesa[GFC_OMP_SPLIT_SIMD].lists[OMP_LIST_REDUCTION]
- = code->ext.omp_clauses->lists[OMP_LIST_REDUCTION];
+ for (int i = OMP_LIST_REDUCTION; i <= OMP_LIST_REDUCTION_TASK; i++)
+ {
+ if (mask & GFC_OMP_MASK_TEAMS)
+ clausesa[GFC_OMP_SPLIT_TEAMS].lists[i]
+ = code->ext.omp_clauses->lists[i];
+ if (mask & GFC_OMP_MASK_PARALLEL)
+ clausesa[GFC_OMP_SPLIT_PARALLEL].lists[i]
+ = code->ext.omp_clauses->lists[i];
+ else if (mask & GFC_OMP_MASK_DO)
+ clausesa[GFC_OMP_SPLIT_DO].lists[i]
+ = code->ext.omp_clauses->lists[i];
+ if (mask & GFC_OMP_MASK_SIMD)
+ clausesa[GFC_OMP_SPLIT_SIMD].lists[i]
+ = code->ext.omp_clauses->lists[i];
+ }
+ if (mask & GFC_OMP_MASK_TARGET)
+ clausesa[GFC_OMP_SPLIT_TARGET].lists[OMP_LIST_IN_REDUCTION]
+ = code->ext.omp_clauses->lists[OMP_LIST_IN_REDUCTION];
+ if (mask & GFC_OMP_MASK_TASKLOOP)
+ clausesa[GFC_OMP_SPLIT_TASKLOOP].lists[OMP_LIST_IN_REDUCTION]
+ = code->ext.omp_clauses->lists[OMP_LIST_IN_REDUCTION];
/* Linear clause is supported on do and simd,
put it on the innermost one. */
clausesa[innermost].lists[OMP_LIST_LINEAR]
{
error_at (OMP_CLAUSE_LOCATION (c),
"invalid %<task%> reduction modifier on construct "
- "other than %<parallel%>, %<for%> or %<sections%>");
+ "other than %<parallel%>, %qs or %<sections%>",
+ lang_GNU_Fortran () ? "do" : "for");
OMP_CLAUSE_REDUCTION_TASK (c) = 0;
}
}
{
error_at (OMP_CLAUSE_LOCATION (*pc),
"invalid %<task%> reduction modifier on construct "
- "other than %<parallel%>, %<for%> or %<sections%>");
+ "other than %<parallel%>, %qs or %<sections%>",
+ lang_GNU_Fortran () ? "do" : "for");
OMP_CLAUSE_REDUCTION_TASK (*pc) = 0;
}
pc = &OMP_CLAUSE_CHAIN (*pc);
{
error_at (gimple_location (stmt),
"%<ordered simd threads%> must be closely "
- "nested inside of %<for simd%> region");
+ "nested inside of %<%s simd%> region",
+ lang_GNU_Fortran () ? "do" : "for");
return false;
}
return true;
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+!
+! (in_)reduction clause
+! Test all in-principle valid combinations, even if
+! not valid in this context (some fail at ME level)
+!
+implicit none
+integer :: a, b, i
+a = 0
+
+! ------------ parallel ------------
+!$omp parallel reduction(+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel reduction(default,+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel reduction(task,+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel reduction(inscan,+:a) ! { dg-error "'inscan' 'reduction' clause on 'parallel' construct" }
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+! ------------ simd ------------
+!$omp simd reduction(+:a)
+do i=1,10
+ a = a + 1
+end do
+
+!$omp simd reduction(default,+:a)
+do i=1,10
+ a = a + 1
+end do
+
+!$omp simd reduction(task,+:a) ! { dg-error "invalid 'task' reduction modifier on construct other than 'parallel', 'do' or 'sections'" }
+do i=1,10
+ a = a + 1
+end do
+
+!$omp simd reduction(inscan,+:a) ! { dg-error "'inscan' 'reduction' clause but not in 'scan' directive clause" }
+do i=1,10
+ a = a + 1
+end do
+
+! ------------ do ------------
+!$omp parallel
+!$omp do reduction(+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel
+!$omp do reduction(default,+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel
+!$omp do reduction(task,+:a)
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+!$omp parallel
+!$omp do reduction(inscan,+:a) ! { dg-error "'a' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" }
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel
+
+! ------------ section ------------
+!$omp parallel
+!$omp sections reduction(+:a)
+ !$omp section
+ a = a + 1
+!$omp end sections
+!$omp end parallel
+
+!$omp parallel
+!$omp sections reduction(default,+:a)
+ !$omp section
+ a = a + 1
+!$omp end sections
+!$omp end parallel
+
+!$omp parallel
+!$omp sections reduction(task,+:a)
+ !$omp section
+ a = a + 1
+!$omp end sections
+!$omp end parallel
+
+!$omp parallel
+!$omp sections reduction(inscan,+:a) ! { dg-error "'inscan' 'reduction' clause on 'sections' construct" }
+ !$omp section
+ a = a + 1
+!$omp end sections
+!$omp end parallel
+
+! ------------ task ------------
+!$omp task in_reduction(+:a)
+ a = a + 1
+!$omp end task
+
+! ------------ taskloop ------------
+!$omp taskloop reduction(+:a) in_reduction(+:b)
+do i=1,10
+ a = a + 1
+end do
+
+!$omp taskloop reduction(default,+:a) in_reduction(+:b)
+do i=1,10
+ a = a + 1
+end do
+
+! ------------ target ------------
+!$omp target in_reduction(+:b)
+ a = a + 1
+!$omp end target
+
+! ------------ teams ------------
+!$omp teams reduction(+:b)
+ a = a + 1
+!$omp end teams
+
+!$omp teams reduction(default, +:b)
+ a = a + 1
+!$omp end teams
+
+! ------------ taskgroup --------
+
+!$omp taskgroup task_reduction(+:b)
+ a = a + 1
+!$omp end taskgroup
+
+end
+
+! { dg-final { scan-tree-dump-times "#pragma omp for reduction\\(\\\+:a\\)" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp for reduction\\(inscan,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp for reduction\\(task,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel\[\n\r\]" 8 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel private\\(i\\) reduction\\(\\\+:a\\)" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel private\\(i\\) reduction\\(inscan,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp parallel private\\(i\\) reduction\\(task,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp section\[\n\r\]" 4 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp sections reduction\\(\\\+:a\\)" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp sections reduction\\(inscan,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp sections reduction\\(task,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp simd linear\\(i:1\\) reduction\\(\\\+:a\\)" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp simd linear\\(i:1\\) reduction\\(inscan,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp simd linear\\(i:1\\) reduction\\(task,\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp target in_reduction\\(\\\+:b\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp task in_reduction\\(\\\+:a\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp teams reduction\\(\\\+:b\\)" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp taskloop reduction\\(\\\+:a\\) in_reduction\\(\\\+:b\\)" 2 "original" } }
--- /dev/null
+! { dg-do compile }
+!
+implicit none
+integer :: a, b, i
+a = 0
+
+!$omp parallel reduction(foo,+:a) ! { dg-error "26: Failed to match clause" }
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel ! { dg-error "Unexpected !.OMP END PARALLEL statement" }
+
+!$omp parallel reduction(task +:a) ! { dg-error "30: Comma expected at" }
+do i=1,10
+ a = a + 1
+end do
+!$omp end parallel ! { dg-error "Unexpected !.OMP END PARALLEL statement" }
+
+!$omp task in_reduction(foo,+:a) ! { dg-error "25: Failed to match clause" }
+ a = a + 1
+!$omp end task ! { dg-error "Unexpected !.OMP END TASK statement" }
+
+!$omp taskloop reduction(inscan,+:a) in_reduction(+:b) ! { dg-error "34: Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i=1,10
+ a = a + 1
+end do
+
+!$omp taskloop reduction(task,+:a) in_reduction(+:b) ! { dg-error "32: Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+do i=1,10
+ a = a + 1
+end do
+
+!$omp teams reduction(inscan,+:b) ! { dg-error "31: Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ a = a + 1
+!$omp end teams
+
+!$omp teams reduction(task, +:b) ! { dg-error "30: Only DEFAULT permitted as reduction-modifier in REDUCTION clause" }
+ a = a + 1
+!$omp end teams
+
+end
subroutine foo
integer :: i
- !$omp do schedule (nonmonotonic: static, 2) ! { dg-error "NONMONOTONIC modifier specified for STATIC schedule kind" }
+ !$omp do schedule (nonmonotonic: static, 2)
do i = 0, 64
end do
- !$omp do schedule (nonmonotonic : static) ! { dg-error "NONMONOTONIC modifier specified for STATIC schedule kind" }
+ !$omp do schedule (nonmonotonic : static)
do i = 0, 64
end do
- !$omp do schedule (nonmonotonic : runtime) ! { dg-error "NONMONOTONIC modifier specified for RUNTIME schedule kind" }
+ !$omp do schedule (nonmonotonic : runtime)
do i = 0, 64
end do
- !$omp do schedule (nonmonotonic : auto) ! { dg-error "NONMONOTONIC modifier specified for AUTO schedule kind" }
+ !$omp do schedule (nonmonotonic : auto)
do i = 0, 64
end do
!$omp do schedule (nonmonotonic : dynamic) ordered ! { dg-error "NONMONOTONIC schedule modifier specified with ORDERED clause" }
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 0, 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_maybe_nonmonotonic_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 0, 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_maybe_nonmonotonic_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 4, 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 4, 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: runtime)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: dynamic)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483650|-2147483646), 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 2, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: dynamic, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: guided)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483651|-2147483645), 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, 3, 3, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_nonmonotonic_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: guided, 3)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop_ull\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: auto)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered reduction (task, *: j) schedule (runtime)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered
+ j = j + 1
+ !$omp end ordered
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_static_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered reduction (task, *: j)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered
+ j = j + 1
+ !$omp end ordered
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483650|-2147483646), 4, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered reduction (task, *: j) schedule (dynamic, 4)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered
+ j = j + 1
+ !$omp end ordered
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_start \[^\n\r]*, (?:2147483651|-2147483645), 6, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_start " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_ordered_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_ordered_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered reduction (task, *: j) schedule (guided, 6)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered
+ j = j + 1
+ !$omp end ordered
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483648|-2147483648), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_runtime_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered(1) reduction (task, *: j) schedule (runtime)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered depend(sink: i - 1)
+ j = j + 1
+ !$omp ordered depend(source)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483649|-2147483647), 0, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_static_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do ordered(1) reduction (task, *: j)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered depend(sink: i - 1)
+ j = j + 1
+ !$omp ordered depend(source)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483650|-2147483646), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_dynamic_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer(8) :: j
+ interface
+ subroutine bar(i)
+ integer(8) :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer(8) :: a, b ,c
+ integer(8) :: i
+ !$omp parallel
+ !$omp do ordered(1) reduction (task, *: j) schedule (dynamic)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered depend(sink: i - 1)
+ j = j + 1
+ !$omp ordered depend(source)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_doacross_start \[^\n\r]*, (?:2147483651|-2147483645), 1, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_post " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_doacross_wait " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_guided_next " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do ordered(1) reduction (task, *: j) schedule (guided)
+ do i = a, b, c
+ call bar (j)
+ !$omp ordered depend(sink: i - 1)
+ j = j + 1
+ !$omp ordered depend(source)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (nonmonotonic: static)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fopenmp -fdump-tree-optimized" }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_start \[^\n\r]*, (?:2147483649|-2147483647), 0, 0B, 0B, " 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_loop_end " 1 "optimized" } }
+! { dg-final { scan-tree-dump-not "__builtin_GOMP_loop\[^\n\r]*_next " "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_workshare_task_reduction_unregister \\(0\\)" 1 "optimized" } }
+! { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel " 1 "optimized" } }
+
+module m
+ implicit none (type, external)
+ integer :: j
+ interface
+ subroutine bar(i)
+ integer :: i
+ end subroutine
+ end interface
+end module m
+
+subroutine foo(a, b, c)
+ use m
+ implicit none (type, external)
+ integer :: a, b ,c
+ integer :: i
+ !$omp parallel
+ !$omp do reduction (task, *: j) schedule (monotonic: static, 2)
+ do i = a, b, c
+ j = j + 1
+ call bar (j)
+ end do
+ !$omp end parallel
+end