2019-07-03 Jakub Jelinek <jakub@redhat.com>
+ * gimplify.c (gimplify_scan_omp_clauses): For inscan reductions
+ on worksharing loop propagate it as shared clause to containing
+ combined parallel.
+
* omp-expand.c (expand_omp_for_static_nochunk,
expand_omp_for_static_chunk): For nowait worksharing loop with
conditional lastprivate clause(s), emit GOMP_loop_end_nowait call
+2019-07-03 Jakub Jelinek <jakub@redhat.com>
+
+ * c-omp.c (c_omp_split_clauses): Put OMP_CLAUSE_REDUCTION_INSCAN
+ clauses on OMP_FOR rather than OMP_PARALLEL when OMP_FOR is combined
+ with OMP_PARALLEL.
+
2019-07-02 qing zhao <qing.zhao@oracle.com>
PR preprocessor/90581
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. If taskloop is combined with
+ sections if parallel is present (unless inscan, in that case
+ omit on parallel). If taskloop is combined with
parallel, omit it on parallel. */
case OMP_CLAUSE_REDUCTION:
if (OMP_CLAUSE_REDUCTION_TASK (clauses))
s = C_OMP_CLAUSE_SPLIT_PARALLEL;
}
else if ((mask & (OMP_CLAUSE_MASK_1
- << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0)
+ << PRAGMA_OMP_CLAUSE_NUM_THREADS)) != 0
+ && !OMP_CLAUSE_REDUCTION_INSCAN (clauses))
s = C_OMP_CLAUSE_SPLIT_PARALLEL;
else
s = C_OMP_CLAUSE_SPLIT_FOR;
" or private in outer context", DECL_NAME (decl));
}
do_notice:
- if ((region_type & ORT_TASKLOOP) == ORT_TASKLOOP
+ if (((region_type & ORT_TASKLOOP) == ORT_TASKLOOP
+ || (region_type == ORT_WORKSHARE
+ && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
+ && OMP_CLAUSE_REDUCTION_INSCAN (c)))
&& outer_ctx
&& outer_ctx->region_type == ORT_COMBINED_PARALLEL
&& (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
2019-07-03 Jakub Jelinek <jakub@redhat.com>
+ * c-c++-common/gomp/scan-5.c: New test.
+
* c-c++-common/gomp/lastprivate-conditional-5.c: New test.
2019-07-02 Jeff Law <law@redhat.com>
--- /dev/null
+int
+foo (int *a, int *b)
+{
+ int r = 0;
+ #pragma omp parallel for reduction (inscan, +:r) default(none) firstprivate (a, b)
+ for (int i = 0; i < 64; i++)
+ {
+ r += a[i];
+ #pragma omp scan inclusive (r) /* { dg-message "sorry, unimplemented: '#pragma omp scan' not supported yet" } */
+ b[i] = r;
+ }
+ return r;
+}