aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-05-31 23:38:35 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-05-31 23:38:35 +0200
commite7393c8936b9cfb1a28f7e16043c107490491ba4 (patch)
treed0fa7f6aa5f6d8bb93ca641511f03dc17e4ee9be /gcc/gimplify.c
parent1ce8fc63a4132b66ced527afd2c88b840ecbb0b9 (diff)
downloadgcc-e7393c8936b9cfb1a28f7e16043c107490491ba4.zip
gcc-e7393c8936b9cfb1a28f7e16043c107490491ba4.tar.gz
gcc-e7393c8936b9cfb1a28f7e16043c107490491ba4.tar.bz2
tree.h (OMP_CLAUSE__CONDTEMP__ITER): Define.
* tree.h (OMP_CLAUSE__CONDTEMP__ITER): Define. * gimplify.c (gimplify_scan_omp_clauses): Allow lastprivate conditional on OMP_SIMD if not nested inside of worksharing loop that also has lastprivate conditional clause for the same decl. (gimplify_omp_for): Add _condtemp_ clauses to OMP_SIMD if needed. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE__CONDTEMP_ also on simd. (lower_rec_input_clauses): Likewise. Handle lastprivate conditional on simd construct. (lower_lastprivate_conditional_clauses): Handle lastprivate conditional on simd construct. (lower_lastprivate_clauses): Likewise. (lower_omp_sections): Call lower_lastprivate_conditional_clauses before calling lower_rec_input_clauses. (lower_omp_for): Likewise. (lower_omp_1): Use first rather than second OMP_CLAUSE__CONDTEMP_ clause on simd construct. * omp-expand.c (expand_omp_simd): Initialize cond_var if OMP_CLAUSE__CONDTEMP_ clause is present. * c-c++-common/gomp/lastprivate-conditional-2.c (foo): Don't expect a sorry on lastprivate conditional on simd construct. * gcc.dg/vect/vect-simd-6.c: New test. * gcc.dg/vect/vect-simd-7.c: New test. From-SVN: r271825
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 12b1eff..d4fbe0c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8146,17 +8146,29 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
}
if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c))
{
- if (code == OMP_FOR
- || code == OMP_SECTIONS
- || region_type == ORT_COMBINED_PARALLEL)
- flags |= GOVD_LASTPRIVATE_CONDITIONAL;
- else
+ splay_tree_node n = NULL;
+ if (code == OMP_SIMD
+ && outer_ctx
+ && outer_ctx->region_type == ORT_WORKSHARE)
+ {
+ n = splay_tree_lookup (outer_ctx->variables,
+ (splay_tree_key) decl);
+ if (n == NULL
+ && outer_ctx->outer_context
+ && (outer_ctx->outer_context->region_type
+ == ORT_COMBINED_PARALLEL))
+ n = splay_tree_lookup (outer_ctx->outer_context->variables,
+ (splay_tree_key) decl);
+ }
+ if (n && (n->value & GOVD_LASTPRIVATE_CONDITIONAL) != 0)
{
sorry_at (OMP_CLAUSE_LOCATION (c),
"%<conditional%> modifier on %<lastprivate%> "
"clause not supported yet");
OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c) = 0;
}
+ else
+ flags |= GOVD_LASTPRIVATE_CONDITIONAL;
}
if (outer_ctx
&& (outer_ctx->region_type == ORT_COMBINED_PARALLEL
@@ -11559,6 +11571,28 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
omp_add_variable (ctx, var, GOVD_CONDTEMP | GOVD_SEEN);
}
}
+ else if (TREE_CODE (orig_for_stmt) == OMP_SIMD)
+ {
+ unsigned lastprivate_conditional = 0;
+ for (tree c = gimple_omp_for_clauses (gfor); c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+ && OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c))
+ ++lastprivate_conditional;
+ if (lastprivate_conditional)
+ {
+ struct omp_for_data fd;
+ omp_extract_for_data (gfor, &fd, NULL);
+ tree type = unsigned_type_for (fd.iter_type);
+ while (lastprivate_conditional--)
+ {
+ tree c = build_omp_clause (UNKNOWN_LOCATION,
+ OMP_CLAUSE__CONDTEMP_);
+ OMP_CLAUSE_DECL (c) = create_tmp_var (type);
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_for_clauses (gfor);
+ gimple_omp_for_set_clauses (gfor, c);
+ }
+ }
+ }
if (ret != GS_ALL_DONE)
return GS_ERROR;