diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-27 11:20:06 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-27 11:20:06 +0000 |
commit | d09768a4b0cde454ba5e81b84bf3177310deae1c (patch) | |
tree | 25ba65398ef4237033d6e7ed198c0ba75295716e /gcc/tree-vect-data-refs.c | |
parent | 6ff51c3a1f35b3f371b2843d7bcf7e30cd625a8d (diff) | |
download | gcc-d09768a4b0cde454ba5e81b84bf3177310deae1c.tar.gz |
* cgraph.h (enum cgraph_simd_clone_arg_type): New.
(struct cgraph_simd_clone_arg, struct cgraph_simd_clone): New.
(struct cgraph_node): Add simdclone and simd_clones fields.
* config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen,
ix86_simd_clone_adjust, ix86_simd_clone_usable): New functions.
(TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN,
TARGET_SIMD_CLONE_ADJUST, TARGET_SIMD_CLONE_USABLE): Define.
* doc/tm.texi.in (TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN,
TARGET_SIMD_CLONE_ADJUST, TARGET_SIMD_CLONE_USABLE): Add.
* doc/tm.texi: Regenerated.
* ggc.h (ggc_alloc_cleared_simd_clone_stat): New function.
* ipa-cp.c (determine_versionability): Fail if "omp declare simd"
attribute is present.
* omp-low.c: Include pretty-print.h, ipa-prop.h and tree-eh.h.
(simd_clone_vector_of_formal_parm_types): New function.
(simd_clone_struct_alloc, simd_clone_struct_copy,
simd_clone_vector_of_formal_parm_types, simd_clone_clauses_extract,
simd_clone_compute_base_data_type, simd_clone_mangle,
simd_clone_create, simd_clone_adjust_return_type,
create_tmp_simd_array, simd_clone_adjust_argument_types,
simd_clone_init_simd_arrays): New functions.
(struct modify_stmt_info): New type.
(ipa_simd_modify_stmt_ops, ipa_simd_modify_function_body,
simd_clone_adjust, expand_simd_clones, ipa_omp_simd_clone): New
functions.
(pass_data_omp_simd_clone): New variable.
(pass_omp_simd_clone): New class.
(make_pass_omp_simd_clone): New function.
* passes.def (pass_omp_simd_clone): New.
* target.def (TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN,
TARGET_SIMD_CLONE_ADJUST, TARGET_SIMD_CLONE_USABLE): New target
hooks.
* target.h (struct cgraph_node, struct cgraph_simd_node): Declare.
* tree-core.h (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE): Document.
* tree.h (OMP_CLAUSE_LINEAR_VARIABLE_STRIDE): Define.
* tree-pass.h (make_pass_omp_simd_clone): New prototype.
* tree-vect-data-refs.c: Include cgraph.h.
(vect_analyze_data_refs): Inline by hand find_data_references_in_loop
and find_data_references_in_bb, if find_data_references_in_stmt
fails, still allow calls to #pragma omp declare simd functions
in #pragma omp simd loops unless they contain data references among
the call arguments or in lhs.
* tree-vect-loop.c (vect_determine_vectorization_factor): Handle
calls with no lhs.
(vect_transform_loop): Allow NULL STMT_VINFO_VECTYPE for calls without
lhs.
* tree-vectorizer.h (enum stmt_vec_info_type): Add
call_simd_clone_vec_info_type.
(struct _stmt_vec_info): Add simd_clone_fndecl field.
(STMT_VINFO_SIMD_CLONE_FNDECL): Define.
* tree-vect-stmts.c: Include tree-ssa-loop.h,
tree-scalar-evolution.h and cgraph.h.
(vectorizable_call): Handle calls without lhs. Assert
!stmt_can_throw_internal instead of failing for it. Don't update
EH stuff.
(struct simd_call_arg_info): New.
(vectorizable_simd_clone_call): New function.
(vect_transform_stmt): Call it.
(vect_analyze_stmt): Likewise. Allow NULL STMT_VINFO_VECTYPE for
calls without lhs.
* ipa-prop.c (ipa_add_new_function): Only call ipa_analyze_node
if cgraph_function_with_gimple_body_p is true.
c/
* c-decl.c (c_builtin_function_ext_scope): Avoid binding if
external_scope is NULL.
cp/
* semantics.c (finish_omp_clauses): For #pragma omp declare simd
linear clause step call maybe_constant_value.
testsuite/
* g++.dg/gomp/declare-simd-1.C (f38): Make sure
simdlen is a power of two.
* gcc.dg/gomp/simd-clones-2.c: Compile on all targets.
Remove -msse2. Adjust regexps for name mangling changes.
* gcc.dg/gomp/simd-clones-3.c: Likewise.
* gcc.dg/vect/vect-simd-clone-1.c: New test.
* gcc.dg/vect/vect-simd-clone-2.c: New test.
* gcc.dg/vect/vect-simd-clone-3.c: New test.
* gcc.dg/vect/vect-simd-clone-4.c: New test.
* gcc.dg/vect/vect-simd-clone-5.c: New test.
* gcc.dg/vect/vect-simd-clone-6.c: New test.
* gcc.dg/vect/vect-simd-clone-7.c: New test.
* gcc.dg/vect/vect-simd-clone-8.c: New test.
* gcc.dg/vect/vect-simd-clone-9.c: New test.
* gcc.dg/vect/vect-simd-clone-10.c: New test.
* gcc.dg/vect/vect-simd-clone-10.h: New file.
* gcc.dg/vect/vect-simd-clone-10a.c: New file.
* gcc.dg/vect/vect-simd-clone-11.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205442 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 82616450e1e..a61f2a1a868 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-scalar-evolution.h" #include "tree-vectorizer.h" #include "diagnostic-core.h" +#include "cgraph.h" /* Need to include rtl.h, expr.h, etc. for optabs. */ #include "expr.h" #include "optabs.h" @@ -3167,10 +3168,11 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, if (loop_vinfo) { + basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo); + loop = LOOP_VINFO_LOOP (loop_vinfo); - if (!find_loop_nest (loop, &LOOP_VINFO_LOOP_NEST (loop_vinfo)) - || find_data_references_in_loop - (loop, &LOOP_VINFO_DATAREFS (loop_vinfo))) + datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + if (!find_loop_nest (loop, &LOOP_VINFO_LOOP_NEST (loop_vinfo))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -3179,7 +3181,57 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, return false; } - datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); + for (i = 0; i < loop->num_nodes; i++) + { + gimple_stmt_iterator gsi; + + for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + if (!find_data_references_in_stmt (loop, stmt, &datarefs)) + { + if (is_gimple_call (stmt) && loop->safelen) + { + tree fndecl = gimple_call_fndecl (stmt), op; + if (fndecl != NULL_TREE) + { + struct cgraph_node *node = cgraph_get_node (fndecl); + if (node != NULL && node->simd_clones != NULL) + { + unsigned int j, n = gimple_call_num_args (stmt); + for (j = 0; j < n; j++) + { + op = gimple_call_arg (stmt, j); + if (DECL_P (op) + || (REFERENCE_CLASS_P (op) + && get_base_address (op))) + break; + } + op = gimple_call_lhs (stmt); + /* Ignore #pragma omp declare simd functions + if they don't have data references in the + call stmt itself. */ + if (j == n + && !(op + && (DECL_P (op) + || (REFERENCE_CLASS_P (op) + && get_base_address (op))))) + continue; + } + } + } + LOOP_VINFO_DATAREFS (loop_vinfo) = datarefs; + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: loop contains function " + "calls or data references that cannot " + "be analyzed\n"); + return false; + } + } + } + + LOOP_VINFO_DATAREFS (loop_vinfo) = datarefs; } else { |