diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-10-13 10:08:59 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-10-13 10:08:59 +0000 |
commit | 1f600feab05dc0737a6e11b871fe31b0698ba812 (patch) | |
tree | 4e5a5ae77f108036483e9d79859170f07a5a626c /gcc/tree-parloops.c | |
parent | d78182cc0ce05104e2f1cd40c97de974f075479f (diff) | |
download | gcc-1f600feab05dc0737a6e11b871fe31b0698ba812.zip gcc-1f600feab05dc0737a6e11b871fe31b0698ba812.tar.gz gcc-1f600feab05dc0737a6e11b871fe31b0698ba812.tar.bz2 |
Add param parloops-schedule
2015-10-13 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/67476
* doc/invoke.texi (@item parloops-schedule): New item.
* params.def (PARAM_PARLOOPS_SCHEDULE): New DEFPARAMENUM5.
* tree-parloops.c: Include params-enum.h.
(create_parallel_loop): Handle PARAM_PARLOOPS_SCHEDULE.
* testsuite/libgomp.c/autopar-3.c: New test.
* testsuite/libgomp.c/autopar-4.c: New test.
* testsuite/libgomp.c/autopar-5.c: New test.
* testsuite/libgomp.c/autopar-6.c: New test.
* testsuite/libgomp.c/autopar-7.c: New test.
* testsuite/libgomp.c/autopar-8.c: New test.
From-SVN: r228756
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r-- | gcc/tree-parloops.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 741392b..62e561c 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "tree-ssa.h" #include "params.h" +#include "params-enum.h" /* This pass tries to distribute iterations of loops into several threads. The implementation is straightforward -- for each loop we test whether its @@ -2086,8 +2087,31 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, gimple_cond_set_lhs (cond_stmt, cvar_base); type = TREE_TYPE (cvar); t = build_omp_clause (loc, OMP_CLAUSE_SCHEDULE); - OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_STATIC; int chunk_size = PARAM_VALUE (PARAM_PARLOOPS_CHUNK_SIZE); + enum PARAM_PARLOOPS_SCHEDULE_KIND schedule_type \ + = (enum PARAM_PARLOOPS_SCHEDULE_KIND) PARAM_VALUE (PARAM_PARLOOPS_SCHEDULE); + switch (schedule_type) + { + case PARAM_PARLOOPS_SCHEDULE_KIND_static: + OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_STATIC; + break; + case PARAM_PARLOOPS_SCHEDULE_KIND_dynamic: + OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_DYNAMIC; + break; + case PARAM_PARLOOPS_SCHEDULE_KIND_guided: + OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_GUIDED; + break; + case PARAM_PARLOOPS_SCHEDULE_KIND_auto: + OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_AUTO; + chunk_size = 0; + break; + case PARAM_PARLOOPS_SCHEDULE_KIND_runtime: + OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_RUNTIME; + chunk_size = 0; + break; + default: + gcc_unreachable (); + } if (chunk_size != 0) OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t) = build_int_cst (integer_type_node, chunk_size); |