aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-04-24 23:17:32 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-04-24 23:17:32 +0200
commitf7468577f88cbfe33e0a5e9a2104a32f7e45c44f (patch)
tree58c72224fbdd8cfd29b26acb0ed228ad9bf56b58 /gcc/omp-low.c
parent2f7ac5ce576962dc7610d8cb3e0b107b05d77bbf (diff)
downloadgcc-f7468577f88cbfe33e0a5e9a2104a32f7e45c44f.zip
gcc-f7468577f88cbfe33e0a5e9a2104a32f7e45c44f.tar.gz
gcc-f7468577f88cbfe33e0a5e9a2104a32f7e45c44f.tar.bz2
tree.h (OMP_CLAUSE_LINEAR_GIMPLE_SEQ): Define.
* tree.h (OMP_CLAUSE_LINEAR_GIMPLE_SEQ): Define. * gimplify.c (omp_is_private): Change last argument's type to int. Only diagnose lastprivate if the simd argument is 1, only diagnose linear if the simd argument is 2. (gimplify_omp_for): Adjust omp_is_private callers. When adding lastprivate or private, add the clause to OMP_FOR_CLAUSES. Pass GOVD_EXPLICIT to omp_add_variable. For simd with collapse == 1 create OMP_CLAUSE_LINEAR rather than OMP_CLAUSE_PRIVATE for var. If var != decl and decl is in OMP_CLAUSE_LINEAR, gimplify decl increment to OMP_CLAUSE_LINEAR_GIMPLE_SEQ. * omp-low.c (scan_sharing_clauses, lower_lastprivate_clauses): Handle OMP_CLAUSE_LINEAR_GIMPLE_SEQ. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Handle OMP_CLAUSE_LINEAR. * testsuite/libgomp.c/simd-7.c: New test. * testsuite/libgomp.c/simd-8.c: New test. * testsuite/libgomp.c/simd-9.c: New test. * testsuite/libgomp.c/loop-16.c: New test. From-SVN: r209760
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index d0489e1..28b2c6ae 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1730,6 +1730,9 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
&& OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
scan_array_reductions = true;
+ else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
+ && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c))
+ scan_array_reductions = true;
break;
case OMP_CLAUSE_SHARED:
@@ -1816,6 +1819,9 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
&& OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c))
scan_omp (&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c), ctx);
+ else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
+ && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c))
+ scan_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c), ctx);
}
/* Create a new name for omp child function. Returns an identifier. */
@@ -3803,6 +3809,14 @@ lower_lastprivate_clauses (tree clauses, tree predicate, gimple_seq *stmt_list,
OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) = NULL;
}
+ else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
+ && OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c))
+ {
+ lower_omp (&OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c), ctx);
+ gimple_seq_add_seq (stmt_list,
+ OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c));
+ OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c) = NULL;
+ }
x = build_outer_var_ref (var, ctx);
if (is_reference (var))