diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-05-31 23:38:35 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-05-31 23:38:35 +0200 |
commit | e7393c8936b9cfb1a28f7e16043c107490491ba4 (patch) | |
tree | d0fa7f6aa5f6d8bb93ca641511f03dc17e4ee9be /gcc/omp-expand.c | |
parent | 1ce8fc63a4132b66ced527afd2c88b840ecbb0b9 (diff) |
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/omp-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 832892794cb..0c31f95ec30 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -4908,7 +4908,10 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) OMP_CLAUSE_IF); tree simdlen = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), OMP_CLAUSE_SIMDLEN); + tree condtemp = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), + OMP_CLAUSE__CONDTEMP_); tree n1, n2; + tree cond_var = condtemp ? OMP_CLAUSE_DECL (condtemp) : NULL_TREE; if (safelen) { @@ -5038,6 +5041,18 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) expand_omp_build_assign (&gsi, fd->loops[i].v, t); } } + if (cond_var) + { + if (POINTER_TYPE_P (type) + || TREE_CODE (n1) != INTEGER_CST + || fd->loop.cond_code != LT_EXPR + || tree_int_cst_sgn (n1) != 1) + expand_omp_build_assign (&gsi, cond_var, + build_one_cst (TREE_TYPE (cond_var))); + else + expand_omp_build_assign (&gsi, cond_var, + fold_convert (TREE_TYPE (cond_var), n1)); + } /* Remove the GIMPLE_OMP_FOR statement. */ gsi_remove (&gsi, true); @@ -5103,6 +5118,19 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) expand_omp_build_assign (&gsi, fd->loops[i].v, t); } } + if (cond_var) + { + if (POINTER_TYPE_P (type) + || TREE_CODE (n1) != INTEGER_CST + || fd->loop.cond_code != LT_EXPR + || tree_int_cst_sgn (n1) != 1) + t = fold_build2 (PLUS_EXPR, TREE_TYPE (cond_var), cond_var, + build_one_cst (TREE_TYPE (cond_var))); + else + t = fold_build2 (PLUS_EXPR, TREE_TYPE (cond_var), cond_var, + fold_convert (TREE_TYPE (cond_var), step)); + expand_omp_build_assign (&gsi, cond_var, t); + } /* Remove GIMPLE_OMP_CONTINUE. */ gsi_remove (&gsi, true); |