aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
AgeCommit message (Collapse)AuthorFilesLines
2012-05-09tree-vectorizer.h (vect_loop_versioning): Adjust prototype.Richard Guenther1-3/+3
2012-05-09 Richard Guenther <rguenther@suse.de> * tree-vectorizer.h (vect_loop_versioning): Adjust prototype. (vect_do_peeling_for_loop_bound): Likewise. (vect_do_peeling_for_alignment): Likewise. * tree-vect-loop-manip.c (conservative_cost_threshold): Remove. (vect_do_peeling_for_loop_bound): Get check_profitability and threshold as parameters. (vect_do_peeling_for_alignment): Likewise. (vect_loop_versioning): Likewise. * tree-vect-loop.c (vect_transform_loop): Compute check_profitability and threshold here. Control where to put the check here. From-SVN: r187323
2012-04-25tree-vectorizer.h (vect_loop_versioning): Adjust prototype.Richard Guenther1-1/+1
2012-04-25 Richard Guenther <rguenther@suse.de> * tree-vectorizer.h (vect_loop_versioning): Adjust prototype. * tree-vect-loop.c (vect_transform_loop): Adjust. * tree-vect-loop-manip.c (vect_do_peeling_for_loop_bound): Record the maximum number of iterations for the epilogue loop. (vect_loop_versioning): Remove case re-using the peeled epilogue loop. From-SVN: r186813
2012-04-17re PR tree-optimization/18437 (vectorizer failed for matrix multiplication)Michael Matz1-0/+3
PR tree-optimization/18437 * tree-vectorizer.h (_stmt_vec_info.stride_load_p): New member. (STMT_VINFO_STRIDE_LOAD_P): New accessor. (vect_check_strided_load): Declare. * tree-vect-data-refs.c (vect_check_strided_load): New function. (vect_analyze_data_refs): Use it to accept strided loads. * tree-vect-stmts.c (vectorizable_load): Ditto and handle them. testsuite/ * gfortran.dg/vect/rnflow-trs2a2.f90: New test. From-SVN: r186530
2012-04-10tree-vectorizer.h (_loop_vec_info.strided_stores): Rename to grouped_stores.Michael Matz1-12/+12
* tree-vectorizer.h (_loop_vec_info.strided_stores): Rename to grouped_stores. (LOOP_VINFO_STRIDED_STORES): Rename to LOOP_VINFO_GROUPED_STORES. (struce _bb_vec_info.strided_stores): Rename to grouped_stores. (BB_VINFO_STRIDED_STORES): Rename to BB_VINFO_GROUPED_STORES. (STMT_VINFO_STRIDED_ACCESS): Rename to STMT_VINFO_GROUPED_ACCESS. (vect_strided_store_supported): Rename to vect_grouped_store_supported. (vect_strided_load_supported): Rename to vect_grouped_load_supported. (vect_transform_strided_load): Rename to vect_transform_grouped_load. (vect_record_strided_load_vectors): Rename to vect_record_grouped_load_vectors. * tree-vect-data-refs.c (vect_update_misalignment_for_peel): Rename use of above macros. (vect_verify_datarefs_alignment): Ditto. (vector_alignment_reachable_p): Ditto. (vect_peeling_hash_get_lowest_cost): Ditto. (vect_enhance_data_refs_alignment): Ditto. (vect_analyze_group_access): Ditto and rename stride to groupsize. (vect_analyze_data_ref_access): Rename "strided" to "grouped". (vect_strided_store_supported): Rename to vect_grouped_store_supported. (vect_strided_load_supported): Rename to vect_grouped_load_supported. (vect_transform_strided_load): Rename to vect_transform_grouped_load. (vect_record_strided_load_vectors): Rename to vect_record_grouped_load_vectors. * tree-vect-loop.c (new_loop_vec_info): Rename use of above macros. (destroy_loop_vec_info): Ditto. (vect_transform_loop): Ditto and rename strided_store to grouped_store. * tree-vect-slp.c (vect_build_slp_tree): Rename use of above macros. (vect_analyze_slp): Ditto. (new_bb_vec_info): Ditto. (destroy_bb_vec_info): Ditto. (vect_schedule_slp_instance): Ditto and rename strided_store to grouped_store. * tree-vect-stmts.c (vect_cost_strided_group_size): Rename to vect_cost_group_size. (vect_model_store_cost): Rename use of above macros and call to vect_cost_strided_group_size. (vect_model_load_cost): Ditto. (vectorizable_store): Ditto, rename strided_store to grouped_store and calls to renamed tree-vectorizer.h functions. (vectorizable_load): Ditto. (vect_transform_stmt): Rename use of above macros and strided_store to grouped_store. testsuite/ * gcc.dg/vect/vect-outer-1-big-array.c: Adjust. * gcc.dg/vect/vect-outer-1.c: Adjust. * gcc.dg/vect/vect-outer-1a-big-array.c: Adjust. * gcc.dg/vect/vect-outer-1a.c: Adjust. * gcc.dg/vect/vect-outer-1b-big-array.c: Adjust. * gcc.dg/vect/vect-outer-1b.c: Adjust. * gcc.dg/vect/vect-outer-2b.c: Adjust. * gcc.dg/vect/vect-outer-3b.c: Adjust. From-SVN: r186285
2012-03-23re PR tree-optimization/52678 (internal compiler error: in ↵Richard Guenther1-0/+8
vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842) 2012-03-23 Richard Guenther <rguenther@suse.de> PR tree-optimization/52678 * tree-vectorizer.h (struct _stmt_vec_info): Add loop_phi_evolution_part member. (STMT_VINFO_LOOP_PHI_EVOLUTION_PART): New define. * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Initialize STMT_VINFO_LOOP_PHI_EVOLUTION_PART. * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Use the cached evolution part and the PHI nodes value from the loop preheader edge instead of re-analyzing the evolution. * gfortran.dg/pr52678.f: New testcase. From-SVN: r185734
2012-03-15tree-vectorizer.h (vect_pattern_recog): Add new argument.Ira Rosen1-1/+1
ChangeLog: * tree-vectorizer.h (vect_pattern_recog): Add new argument. * tree-vect-loop.c (vect_analyze_loop_2): Update call to vect_pattern_recog. * tree-vect-patterns.c (widened_name_p): Pass basic block info to vect_is_simple_use. (vect_recog_dot_prod_pattern): Fail for basic blocks. (vect_recog_widen_sum_pattern): Likewise. (vect_handle_widen_op_by_const): Support basic blocks. (vect_operation_fits_smaller_type, vect_recog_over_widening_pattern): Likewise. (vect_recog_vector_vector_shift_pattern): Support basic blocks. Update call to vect_is_simple_use. (vect_recog_mixed_size_cond_pattern): Support basic blocks. Add printing. (check_bool_pattern): Add an argument, update call to vect_is_simple_use and the recursive calls. (vect_recog_bool_pattern): Update relevant function calls. Add printing. (vect_mark_pattern_stmts): Update calls to new_stmt_vec_info. (vect_pattern_recog_1): Check for reduction only in loops. (vect_pattern_recog): Add new argument. Support basic blocks. * tree-vect-stmts.c (vectorizable_conversion): Pass basic block info to vect_is_simple_use_1. * tree-vect-slp.c (vect_get_and_check_slp_defs): Support basic blocks. (vect_slp_analyze_bb_1): Call vect_pattern_recog. testsuite/ChangeLog: * gcc.dg/vect/bb-slp-pattern-1.c: New test. * gcc.dg/vect/bb-slp-pattern-2.c: New test. Co-Authored-By: Ulrich Weigand <ulrich.weigand@linaro.org> From-SVN: r185436
2012-02-05re PR tree-optimization/52091 (ICE: verify_gimple failed)Ira Rosen1-3/+5
PR tree-optimization/52091 * tree-vectorizer.h (vect_is_simple_use): Add an argument. (vect_is_simple_use_1): Likewise. * tree-vect-loop.c (vectorizable_reduction): Update calls to vect_is_simple_use_1 and vect_is_simple_use. (vectorizable_live_operation): Likewise. * tree-vect-patterns.c (widened_name_p, vect_recog_vector_vector_shift_pattern, check_bool_pattern): Likewise. * tree-vect-stmts.c (process_use, vect_get_vec_def_for_operand, vectorizable_call, vectorizable_conversion, vectorizable_assignment, vectorizable_shift, vectorizable_operation, vectorizable_store, vectorizable_load): Likewise. (vect_is_simple_cond): Add an argument, pass it to vect_is_simple_use_1. (vectorizable_condition): Update calls to vect_is_simple_cond, vect_is_simple_use. (vect_is_simple_use): Add an argument, the statement in which OPERAND is used. Check that if OPERAND's def stmt is a double reduction phi node, the use is a phi node too. (vect_is_simple_use_1): Add an argument, pass it to vect_is_simple_use. * tree-vect-slp.c (vect_get_and_check_slp_defs): Update a call to vect_is_simple_use. From-SVN: r183902
2011-12-23Delete VEC_INTERLEAVE_*_EXPR.Jakub Jelinek1-0/+1
* tree.def (VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): Remove. * gimple-pretty-print.c (dump_binary_rhs): Don't handle VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. * expr.c (expand_expr_real_2): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * fold-const.c (fold_binary_loc): Likewise. * doc/generic.texi (VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): Remove documentation. * optabs.c (optab_for_tree_code): Don't handle VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. (expand_binop, init_optabs): Remove vec_interleave_high_optab and vec_interleave_low_optab. * genopinit.c (optabs): Likewise. * optabs.h (OTI_vec_interleave_high, OTI_vec_interleave_low): Remove. (vec_interleave_high_optab, vec_interleave_low_optab): Remove. * doc/md.texi (vec_interleave_high, vec_interleave_low): Remove documentation. * tree-vect-stmts.c (gen_perm_mask): Renamed to... (vect_gen_perm_mask): ... this. No longer static. (perm_mask_for_reverse, vectorizable_load): Adjust callers. * tree-vectorizer.h (vect_gen_perm_mask): New prototype. * tree-vect-data-refs.c (vect_strided_store_supported): Don't try VEC_INTERLEAVE_*_EXPR, use can_vec_perm_p instead of can_vec_perm_for_code_p. (vect_permute_store_chain): Generate VEC_PERM_EXPR with interleaving masks instead of VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. * config/i386/i386.c (expand_vec_perm_interleave2): If expand_vec_perm_interleave3 would handle it, return false. (expand_vec_perm_broadcast_1): Don't use vec_interleave_*_optab. From-SVN: r182663
2011-12-15tree-vectorizer.h (struct _stmt_vec_info): Remove pattern_def_stmt field, ↵Jakub Jelinek1-4/+4
add pattern_def_seq. * tree-vectorizer.h (struct _stmt_vec_info): Remove pattern_def_stmt field, add pattern_def_seq. (STMT_VINFO_PATTERN_DEF_STMT): Remove. (STMT_VINFO_PATTERN_DEF_SEQ): Define. (NUM_PATTERNS): Bump to 10. * tree-vect-loop.c (vect_determine_vectorization_factor, vect_transform_loop): Adjust for pattern def changing from a single gimple stmt to gimple_seq. * tree-vect-stmts.c (vect_analyze_stmt, new_stmt_vec_info, free_stmt_vec_info): Likewise. * tree-vect-patterns.c (vect_recog_over_widening_pattern, vect_recog_vector_vector_shift_pattern, vect_recog_mixed_size_cond_pattern, adjust_bool_pattern_cast, adjust_bool_pattern, vect_mark_pattern_stmts): Likewise. (vect_recog_sdivmod_pow2_pattern): New function. (vect_vect_recog_func_ptrs): Add it. * config/i386/sse.md (vcond<V_256:mode><VI_256:mode>, vcond<V_128:mode><VI124_128:mode>, vcond<VI8F_128:mode>v2di): Use general_operand instead of nonimmediate_operand for operand 5 and no predicate for operands 1 and 2. * config/i386/i386.c (ix86_expand_int_vcond): Optimize x < 0 ? -1 : 0 and x < 0 ? 1 : 0 into vector arithmetic resp. logical shift. * gcc.dg/vect/vect-sdivmod-1.c: New test. From-SVN: r182388
2011-12-13Revert two unintended commitsRichard Henderson1-1/+0
From-SVN: r182301
2011-12-13Delete VEC_INTERLEAVE_*_EXPR.Richard Henderson1-0/+1
* tree.def (VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): Remove. * gimple-pretty-print.c (dump_binary_rhs): Don't handle VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. * expr.c (expand_expr_real_2): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * fold-const.c (fold_binary_loc): Likewise. * doc/generic.texi (VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): Remove documentation. * optabs.c (optab_for_tree_code): Don't handle VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. (expand_binop, init_optabs): Remove vec_interleave_high_optab and vec_interleave_low_optab. * genopinit.c (optabs): Likewise. * optabs.h (OTI_vec_interleave_high, OTI_vec_interleave_low): Remove. (vec_interleave_high_optab, vec_interleave_low_optab): Remove. * doc/md.texi (vec_interleave_high, vec_interleave_low): Remove documentation. * tree-vect-stmts.c (gen_perm_mask): Renamed to... (vect_gen_perm_mask): ... this. No longer static. (perm_mask_for_reverse, vectorizable_load): Adjust callers. * tree-vectorizer.h (vect_gen_perm_mask): New prototype. * tree-vect-data-refs.c (vect_strided_store_supported): Don't try VEC_INTERLEAVE_*_EXPR, use can_vec_perm_p instead of can_vec_perm_for_code_p. (vect_permute_store_chain): Generate VEC_PERM_EXPR with interleaving masks instead of VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. * config/i386/i386.c (expand_vec_perm_interleave2): If expand_vec_perm_interleave3 would handle it, return false. (expand_vec_perm_broadcast_1): Don't use vec_interleave_*_optab. From-SVN: r182298
2011-11-07re PR tree-optimization/50789 (Gather vectorization)Jakub Jelinek1-0/+6
PR tree-optimization/50789 * tree-vect-stmts.c (process_use): Add force argument, avoid exist_non_indexing_operands_for_use_p check if true. (vect_mark_stmts_to_be_vectorized): Adjust callers. Handle STMT_VINFO_GATHER_P. (gen_perm_mask): New function. (perm_mask_for_reverse): Use it. (reverse_vec_element): Rename to... (permute_vec_elements): ... this. Add Y and MASK_VEC arguments, generalize for any permutations. (vectorizable_load): Adjust caller. Handle STMT_VINFO_GATHER_P. * target.def (TARGET_VECTORIZE_BUILTIN_GATHER): New hook. * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_GATHER): Document it. * doc/tm.texi: Regenerate. * tree-data-ref.c (initialize_data_dependence_relation, compute_self_dependence): No longer static. * tree-data-ref.h (initialize_data_dependence_relation, compute_self_dependence): New prototypes. * tree-vect-data-refs.c (vect_check_gather): New function. (vect_analyze_data_refs): Detect possible gather load data refs. * tree-vectorizer.h (struct _stmt_vec_info): Add gather_p field. (STMT_VINFO_GATHER_P): Define. (vect_check_gather): New prototype. * config/i386/i386-builtin-types.def: Add types for alternate gather builtins. * config/i386/sse.md (AVXMODE48P_DI): Remove. (VEC_GATHER_MODE): Rename mode_attr to... (VEC_GATHER_IDXSI): ... this. (VEC_GATHER_IDXDI, VEC_GATHER_SRCDI): New mode_attrs. (avx2_gathersi<mode>, *avx2_gathersi<mode>): Use <VEC_GATHER_IDXSI> instead of <VEC_GATHER_MODE>. (avx2_gatherdi<mode>): Use <VEC_GATHER_IDXDI> instead of <<AVXMODE48P_DI> and <VEC_GATHER_SRCDI> instead of VEC_GATHER_MODE on src and mask operands. (*avx2_gatherdi<mode>): Likewise. Use VEC_GATHER_MODE iterator instead of AVXMODE48P_DI. (avx2_gatherdi<mode>256, *avx2_gatherdi<mode>256): Removed. * config/i386/i386.c (enum ix86_builtins): Add IX86_BUILTIN_GATHERALTSIV4DF, IX86_BUILTIN_GATHERALTDIV8SF, IX86_BUILTIN_GATHERALTSIV4DI and IX86_BUILTIN_GATHERALTDIV8SI. (ix86_init_mmx_sse_builtins): Create those builtins. (ix86_expand_builtin): Handle those builtins and adjust expansions of other gather builtins. (ix86_vectorize_builtin_gather): New function. (TARGET_VECTORIZE_BUILTIN_GATHER): Define. * gcc.target/i386/avx2-gather-1.c: New test. * gcc.target/i386/avx2-gather-2.c: New test. * gcc.target/i386/avx2-gather-3.c: New test. * gcc.target/i386/avx2-gather-4.c: New test. From-SVN: r181089
2011-11-06tree-vectorizer.h (vectorizable_condition): Add argument.Ira Rosen1-1/+1
* tree-vectorizer.h (vectorizable_condition): Add argument. * tree-vect-loop.c (vectorizable_reduction): Fail for condition in SLP. Update calls to vectorizable_condition. * tree-vect-stmts.c (vect_is_simple_cond): Add basic block info to the arguments. Pass it to vect_is_simple_use_1. (vectorizable_condition): Add slp_node to the arguments. Support vectorization of basic blocks. Fail for reduction in SLP. Update calls to vect_is_simple_cond and vect_is_simple_use. Support SLP: call vect_get_slp_defs to get vector operands. (vect_analyze_stmt): Update calls to vectorizable_condition. (vect_transform_stmt): Likewise. * tree-vect-slp.c (vect_create_new_slp_node): Handle COND_EXPR. (vect_get_and_check_slp_defs): Handle COND_EXPR. Allow pattern def stmts. (vect_build_slp_tree): Handle COND_EXPR. (vect_analyze_slp_instance): Push pattern statements to root node. (vect_get_constant_vectors): Fix comments. Handle COND_EXPR. From-SVN: r181026
2011-11-03re PR tree-optimization/50912 (gimple assertion failure at gimple.h:1940 ↵Ira Rosen1-10/+31
with -msse2) PR tree-optimization/50912 * tree-vectorizer.h (slp_void_p): New. (struct _slp_tree): Replace left and right with children. Update documentation. (struct _slp_oprnd_info): New. (vect_get_vec_defs): Declare. (vect_get_slp_defs): Update arguments. * tree-vect-loop.c (vect_create_epilog_for_reduction): Call vect_get_vec_defs instead of vect_get_slp_defs. (vectorizable_reduction): Likewise. * tree-vect-stmts.c (vect_get_vec_defs): Remove static, add argument. Update call to vect_get_slp_defs. (vectorizable_conversion): Update call to vect_get_vec_defs. (vectorizable_assignment, vectorizable_shift, vectorizable_operation): Likewise. (vectorizable_type_demotion): Call vect_get_vec_defs instead of vect_get_slp_defs. (vectorizable_type_promotion, vectorizable_store): Likewise. (vect_analyze_stmt): Fix typo. * tree-vect-slp.c (vect_free_slp_tree): Update SLP tree traversal. (vect_print_slp_tree, vect_mark_slp_stmts, vect_mark_slp_stmts_relevant, vect_slp_rearrange_stmts, vect_detect_hybrid_slp_stmts, vect_slp_analyze_node_operations, vect_schedule_slp_instance): Likewise. (vect_create_new_slp_node): New. (vect_create_oprnd_info, vect_free_oprnd_info): Likewise. (vect_get_and_check_slp_defs): Pass information about defs using oprnds_info, allow any number of operands. (vect_build_slp_tree): Likewise. Update calls to vect_get_and_check_slp_defs. Fix comments. (vect_analyze_slp_instance): Move node creation to vect_create_new_slp_node. (vect_get_slp_defs): Allow any number of operands. From-SVN: r180819
2011-10-30tree-vectorizer.h (NUM_PATTERNS): Bump to 9.Jakub Jelinek1-1/+1
* tree-vectorizer.h (NUM_PATTERNS): Bump to 9. * tree-vect-patterns.c (vect_recog_vector_vector_shift_pattern): New function. (vect_vect_recog_func_ptrs): Add it. From-SVN: r180677
2011-10-23re PR tree-optimization/50819 (missed SLP vectorization)Ira Rosen1-1/+1
PR tree-optimization/50819 * tree-vectorizer.h (vect_analyze_data_ref_dependences): Remove the last argument. * tree-vect-loop.c (vect_analyze_loop_2): Update call to vect_analyze_data_ref_dependences. * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Remove the last argument. Check load-after-store dependence for unknown dependencies in basic blocks. (vect_analyze_data_ref_dependences): Update call to vect_analyze_data_ref_dependences. * tree-vect-patterns.c (vect_recog_widen_shift_pattern): Fix typo. * tree-vect-slp.c (vect_bb_vectorizable_with_dependencies): Remove. (vect_slp_analyze_bb_1): Update call to vect_analyze_data_ref_dependences. Don't call vect_bb_vectorizable_with_dependencies. From-SVN: r180334
2011-10-18md.texi (vec_widen_ushiftl_hi, [...]): Document.Ira Rosen1-1/+1
* doc/md.texi (vec_widen_ushiftl_hi, vec_widen_ushiftl_lo, vec_widen_sshiftl_hi, vec_widen_sshiftl_lo): Document. * tree-pretty-print.c (dump_generic_node): Handle WIDEN_LSHIFT_EXPR, VEC_WIDEN_LSHIFT_HI_EXPR and VEC_WIDEN_LSHIFT_LO_EXPR. (op_code_prio): Likewise. (op_symbol_code): Handle WIDEN_LSHIFT_EXPR. * optabs.c (optab_for_tree_code): Handle VEC_WIDEN_LSHIFT_HI_EXPR and VEC_WIDEN_LSHIFT_LO_EXPR. (init-optabs): Initialize optab codes for vec_widen_u/sshiftl_hi/lo. * optabs.h (enum optab_index): Add OTI_vec_widen_u/sshiftl_hi/lo. * genopinit.c (optabs): Initialize the new optabs. * expr.c (expand_expr_real_2): Handle VEC_WIDEN_LSHIFT_HI_EXPR and VEC_WIDEN_LSHIFT_LO_EXPR. * gimple-pretty-print.c (dump_binary_rhs): Likewise. * tree-vectorizer.h (NUM_PATTERNS): Increase to 8. * tree.def (WIDEN_LSHIFT_EXPR, VEC_WIDEN_LSHIFT_HI_EXPR, VEC_WIDEN_LSHIFT_LO_EXPR): New. * cfgexpand.c (expand_debug_expr): Handle new tree codes. * tree-vect-patterns.c (vect_vect_recog_func_ptrs): Add vect_recog_widen_shift_pattern. (vect_handle_widen_mult_by_const): Rename... (vect_handle_widen_op_by_const): ...to this. Handle shifts. Add a new argument, update documentation. (vect_recog_widen_mult_pattern): Assume that only second operand can be constant. Update call to vect_handle_widen_op_by_const. (vect_recog_over_widening_pattern): Fix typo. (vect_recog_widen_shift_pattern): New. * tree-vect-stmts.c (vectorizable_type_promotion): Handle widening shifts. (supportable_widening_operation): Likewise. * tree-inline.c (estimate_operator_cost): Handle new tree codes. * tree-vect-generic.c (expand_vector_operations_1): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * config/arm/neon.md (neon_vec_<US>shiftl_<mode>): New. (vec_widen_<US>shiftl_lo_<mode>, neon_vec_<US>shiftl_hi_<mode>, vec_widen_<US>shiftl_hi_<mode>, neon_vec_<US>shift_left_<mode>): Likewise. * config/arm/predicates.md (const_neon_scalar_shift_amount_operand): New. * config/arm/iterators.md (V_innermode): New. * tree-vect-slp.c (vect_build_slp_tree): Require same shift operand for widening shift. From-SVN: r180128
2011-10-16re PR tree-optimization/50596 (Problems in vectorization of condition ↵Jakub Jelinek1-1/+1
expression) PR tree-optimization/50596 * tree-vectorizer.h (NUM_PATTERNS): Increase to 7. * tree-vect-patterns.c (vect_vect_recog_func_ptrs): Add vect_recog_bool_pattern. (check_bool_pattern, adjust_bool_pattern_cast, adjust_bool_pattern, vect_recog_bool_pattern): New functions. * gcc.dg/vect/vect-cond-9.c: New test. From-SVN: r180057
2011-10-07re PR middle-end/50650 (ICE in vect_is_simple_use_1, at tree-vect-stmts.c:5689)Jakub Jelinek1-1/+0
PR tree-optimization/50650 * tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): Don't call vect_is_simple_cond here, instead fail if cond_expr isn't COMPARISON_CLASS_P or if get_vectype_for_scalar_type returns NULL for cond_expr's first operand. * tree-vect-stmts.c (vect_is_simple_cond): Static again. * tree-vectorizer.h (vect_is_simple_cond): Remove prototype. * gcc.c-torture/compile/pr50650.c: New test. From-SVN: r179653
2011-10-06re PR tree-optimization/50596 (Problems in vectorization of condition ↵Jakub Jelinek1-2/+3
expression) PR tree-optimization/50596 * tree-vectorizer.h (vect_is_simple_cond): New prototype. (NUM_PATTERNS): Change to 6. * tree-vect-patterns.c (vect_recog_mixed_size_cond_pattern): New function. (vect_vect_recog_func_ptrs): Add vect_recog_mixed_size_cond_pattern. (vect_mark_pattern_stmts): Don't create stmt_vinfo for def_stmt if it already has one, and don't set STMT_VINFO_VECTYPE in it if it is already set. * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Handle COND_EXPR in pattern stmts. (vect_is_simple_cond): No longer static. * lib/target-supports.exp (check_effective_target_vect_cond_mixed): New. * gcc.dg/vect/vect-cond-8.c: New test. From-SVN: r179626
2011-08-04tree-vectorizer.h (struct _stmt_vec_info): Add new field for pattern def ↵Ira Rosen1-1/+6
statement, and its access macro. * tree-vectorizer.h (struct _stmt_vec_info): Add new field for pattern def statement, and its access macro. (NUM_PATTERNS): Set to 5. * tree-vect-loop.c (vect_determine_vectorization_factor): Handle pattern def statement. (vect_transform_loop): Likewise. * tree-vect-patterns.c (vect_vect_recog_func_ptrs): Add new function vect_recog_over_widening_pattern (). (vect_operation_fits_smaller_type): New function. (vect_recog_over_widening_pattern, vect_mark_pattern_stmts): Likewise. (vect_pattern_recog_1): Move the code that marks pattern statements to vect_mark_pattern_stmts (), and call it. Update documentation. * tree-vect-stmts.c (vect_supportable_shift): New function. (vect_analyze_stmt): Handle pattern def statement. (new_stmt_vec_info): Initialize pattern def statement. From-SVN: r177409
2011-06-16tree-vectorizer.h (vect_recog_func_ptr): Change the first argument to be a ↵Ira Rosen1-1/+1
VEC of statements. * tree-vectorizer.h (vect_recog_func_ptr): Change the first argument to be a VEC of statements. * tree-vect-loop.c (vect_determine_vectorization_factor): Remove the assert that pattern statements have to have their vector type set. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Change the first argument to be a VEC of statements. Update documentation. (vect_recog_dot_prod_pattern, vect_recog_pow_pattern): Likewise. (vect_handle_widen_mult_by_const): New function. (vect_recog_widen_mult_pattern): Change the first argument to be a VEC of statements. Update documentation. Check that the constant is INTEGER_CST. Support multiplication by a constant that fits an intermediate type - call vect_handle_widen_mult_by_const. (vect_pattern_recog_1): Update vect_recog_func_ptr and its call. Handle additional pattern statements if necessary. From-SVN: r175102
2011-06-07tree-vectorizer.h (vect_recog_func_ptr): Make last argument to be a pointer.Ira Rosen1-1/+1
* tree-vectorizer.h (vect_recog_func_ptr): Make last argument to be a pointer. * tree-vect-patterns.c (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern, vect_recog_dot_prod_pattern, vect_recog_pow_pattern): Likewise. (vect_pattern_recog_1): Remove declaration. (widened_name_p): Remove declaration. Add new argument to specify whether to check that both types are either signed or unsigned. (vect_recog_widen_mult_pattern): Update documentation. Handle unsigned patterns and multiplication by constants. (vect_pattern_recog_1): Update vect_recog_func references. Use statement information from the statement returned from pattern detection functions. (vect_pattern_recog): Update vect_recog_func reference. * tree-vect-stmts.c (vectorizable_type_promotion): For widening multiplication by a constant use the type of the other operand. From-SVN: r174735
2011-05-26re PR tree-optimization/49038 (-ftree-vectorise introduces reads past end of ↵Ira Rosen1-0/+6
array) PR tree-optimization/49038 * tree-vect-loop-manip.c (vect_generate_tmps_on_preheader): Ensure at least one epilogue iteration if required by data accesses with gaps. * tree-vectorizer.h (struct _loop_vec_info): Add new field to mark loops that require peeling for gaps. * tree-vect-loop.c (new_loop_vec_info): Initialize new field. (vect_get_known_peeling_cost): Take peeling for gaps into account. (vect_transform_loop): Generate epilogue if required by data access with gaps. * tree-vect-data-refs.c (vect_analyze_group_access): Mark the loop as requiring an epilogue if there are gaps in the end of the strided group. From-SVN: r174265
2011-05-18re PR tree-optimization/41881 (Complete unrolling (inner) versus ↵Ira Rosen1-0/+5
vectorization of reduction) PR tree-optimization/41881 * tree-vectorizer.h (struct _loop_vec_info): Add new field reduction_chains along with a macro for its access. * tree-vect-loop.c (new_loop_vec_info): Initialize reduction chains. (destroy_loop_vec_info): Free reduction chains. (vect_analyze_loop_2): Return false if vect_analyze_slp() returns false. (vect_is_slp_reduction): New function. (vect_is_simple_reduction_1): Call vect_is_slp_reduction. (vect_create_epilog_for_reduction): Support SLP reduction chains. * tree-vect-slp.c (vect_get_and_check_slp_defs): Allow different definition types for reduction chains. (vect_supported_load_permutation_p): Don't allow permutations for reduction chains. (vect_analyze_slp_instance): Support reduction chains. (vect_analyze_slp): Try to build SLP instance from reduction chains. (vect_get_constant_vectors): Handle reduction chains. (vect_schedule_slp_instance): Mark the first statement of the reduction chain as reduction. From-SVN: r173856
2011-05-18tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): Use new names ↵Ira Rosen1-24/+24
for group elements access. * tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): Use new names for group elements access. * tree-vectorizer.h (struct _stmt_vec_info): Use interleaving info for reduction chains as well. Remove data reference and interleaving related words from the fields names. * tree-vect-loop.c (vect_transform_loop): Use new names for group elements access. * tree-vect-data-refs.c (vect_get_place_in_interleaving_chain, vect_insert_into_interleaving_chain, vect_update_interleaving_chain, vect_update_interleaving_chain, vect_same_range_drs, vect_analyze_data_ref_dependence, vect_update_misalignment_for_peel, vect_verify_datarefs_alignment, vector_alignment_reachable_p, vect_peeling_hash_get_lowest_cost, vect_enhance_data_refs_alignment, vect_analyze_group_access, vect_analyze_data_ref_access, vect_create_data_ref_ptr, vect_transform_strided_load, vect_record_strided_load_vectors): Likewise. * tree-vect-stmts.c (vect_model_simple_cost, vect_model_store_cost, vect_model_load_cost, vectorizable_store, vectorizable_load, vect_remove_stores, new_stmt_vec_info): Likewise. * tree-vect-slp.c (vect_build_slp_tree, vect_supported_slp_permutation_p, vect_analyze_slp_instance): Likewise. From-SVN: r173855
2011-05-03md.texi (vec_load_lanes, [...]): Document.Richard Sandiford1-3/+6
gcc/ * doc/md.texi (vec_load_lanes, vec_store_lanes): Document. * optabs.h (COI_vec_load_lanes, COI_vec_store_lanes): New convert_optab_index values. (vec_load_lanes_optab, vec_store_lanes_optab): New convert optabs. * genopinit.c (optabs): Initialize the new optabs. * internal-fn.def (LOAD_LANES, STORE_LANES): New internal functions. * internal-fn.c (get_multi_vector_move, expand_LOAD_LANES) (expand_STORE_LANES): New functions. * tree.h (build_array_type_nelts): Declare. * tree.c (build_array_type_nelts): New function. * tree-vectorizer.h (vect_model_store_cost): Add a bool argument. (vect_model_load_cost): Likewise. (vect_store_lanes_supported, vect_load_lanes_supported) (vect_record_strided_load_vectors): Declare. * tree-vect-data-refs.c (vect_lanes_optab_supported_p) (vect_store_lanes_supported, vect_load_lanes_supported): New functions. (vect_transform_strided_load): Split out statement recording into... (vect_record_strided_load_vectors): ...this new function. * tree-vect-stmts.c (create_vector_array, read_vector_array) (write_vector_array, create_array_ref): New functions. (vect_model_store_cost): Add store_lanes_p argument. (vect_model_load_cost): Add load_lanes_p argument. (vectorizable_store): Try to use store-lanes functions for interleaved stores. (vectorizable_load): Likewise load-lanes and loads. * tree-vect-slp.c (vect_get_and_check_slp_defs): Update call to vect_model_store_cost. (vect_build_slp_tree): Likewise vect_model_load_cost. From-SVN: r173291
2011-04-28re PR tree-optimization/48765 (ICE in vect_transform_stmt)Ira Rosen1-1/+1
PR tree-optimization/48765 * tree-vectorizer.h (vect_make_slp_decision): Return bool. * tree-vect-loop.c (vect_analyze_loop_operations): Add new argument to indicate if loop aware SLP is being used. Scan the statements and update the vectorization factor according to the type of vectorization before statement analysis. (vect_analyze_loop_2): Get a return value from vect_make_slp_decision, pass it to vect_analyze_loop_operations. (vectorizable_reduction): Set number of copies to 1 in case of pure SLP statement. * tree-vect-stmts.c (vectorizable_conversion, vectorizable_assignment, vectorizable_shift, vectorizable_operation, vectorizable_type_demotion, vectorizable_type_promotion, vectorizable_store, vectorizable_load): Likewise. (vectorizable_condition): Move the check that it is not SLP vectorization before the number of copies check. * tree-vect-slp.c (vect_make_slp_decision): Return TRUE if decided to vectorize the loop using SLP. From-SVN: r173132
2011-04-20Revert last patch.Richard Sandiford1-6/+3
From-SVN: r172763
2011-04-20md.texi (vec_load_lanes, [...]): Document.Richard Sandiford1-3/+6
gcc/ * doc/md.texi (vec_load_lanes, vec_store_lanes): Document. * optabs.h (COI_vec_load_lanes, COI_vec_store_lanes): New convert_optab_index values. (vec_load_lanes_optab, vec_store_lanes_optab): New convert optabs. * genopinit.c (optabs): Initialize the new optabs. * internal-fn.def (LOAD_LANES, STORE_LANES): New internal functions. * internal-fn.c (get_multi_vector_move, expand_LOAD_LANES) (expand_STORE_LANES): New functions. * tree.h (build_array_type_nelts): Declare. * tree.c (build_array_type_nelts): New function. * tree-vectorizer.h (vect_model_store_cost): Add a bool argument. (vect_model_load_cost): Likewise. (vect_store_lanes_supported, vect_load_lanes_supported) (vect_record_strided_load_vectors): Declare. * tree-vect-data-refs.c (vect_lanes_optab_supported_p) (vect_store_lanes_supported, vect_load_lanes_supported): New functions. (vect_transform_strided_load): Split out statement recording into... (vect_record_strided_load_vectors): ...this new function. * tree-vect-stmts.c (create_vector_array, read_vector_array) (write_vector_array, create_array_ref): New functions. (vect_model_store_cost): Add store_lanes_p argument. (vect_model_load_cost): Add load_lanes_p argument. (vectorizable_store): Try to use store-lanes functions for interleaved stores. (vectorizable_load): Likewise load-lanes and loads. * tree-vect-slp.c (vect_get_and_check_slp_defs) (vect_build_slp_tree): From-SVN: r172760
2011-04-14tree-vectorizer.h (vect_strided_store_supported): Add a HOST_WIDE_INT argument.Richard Sandiford1-6/+4
gcc/ * tree-vectorizer.h (vect_strided_store_supported): Add a HOST_WIDE_INT argument. (vect_strided_load_supported): Likewise. (vect_permute_store_chain): Return void. (vect_transform_strided_load): Likewise. (vect_permute_load_chain): Delete. * tree-vect-data-refs.c (vect_strided_store_supported): Take a count argument. Check that the count is a power of two. (vect_strided_load_supported): Likewise. (vect_permute_store_chain): Return void. Update after above changes. Assert that the access is supported. (vect_permute_load_chain): Likewise. (vect_transform_strided_load): Return void. * tree-vect-stmts.c (vectorizable_store): Update calls after above interface changes. (vectorizable_load): Likewise. (vect_analyze_stmt): Don't check for strided powers of two here. From-SVN: r172428
2011-04-14tree-vectorizer.h (vect_create_data_ref_ptr): Add an extra type parameter.Richard Sandiford1-3/+3
gcc/ * tree-vectorizer.h (vect_create_data_ref_ptr): Add an extra type parameter. * tree-vect-data-refs.c (vect_create_data_ref_ptr): Add an aggr_type parameter. Generalise code to handle arrays as well as vectors. (vect_setup_realignment): Update accordingly. * tree-vect-stmts.c (vectorizable_store): Likewise. (vectorizable_load): Likewise. From-SVN: r172423
2011-03-28tree-vectorizer.h (vect_create_data_ref_ptr): Adjust prototype.Eric Botcazou1-1/+2
* tree-vectorizer.h (vect_create_data_ref_ptr): Adjust prototype. * tree-vect-data-refs.c (vect_create_data_ref_ptr): Add GSI parameter. Insert new statements at it in lieu of STMT. (vect_setup_realignment): Adjust call to vect_create_data_ref_ptr. * tree-vect-stmts.c (vectorizable_store): Likewise. (vectorizable_load): Likewise. From-SVN: r171592
2010-12-23Fix PR47002: memory leaks.Sebastian Pop1-0/+4
2010-12-23 Sebastian Pop <sebastian.pop@amd.com> PR tree-optimization/47002 * tree-data-ref.c (compute_data_dependences_for_loop): Pass in a pointer to the loop_nest. (analyze_all_data_dependences): Initialize and free the loop_nest. (free_dependence_relations): Do not free loop_nest. (build_rdg): Pass in the loop_nest, datarefs, and dependence_relations. (free_rdg): Also free the data on edges. * tree-data-ref.h (build_rdg): Update declaration. (compute_data_dependences_for_loop): Same. * tree-if-conv.c (if_convertible_loop_p_1): Pass in the loop_nest. (if_convertible_loop_p): Allocate and free loop_nest. * tree-loop-distribution.c (rdg_flag_loop_exits): Free conds. (free_rdg_components): VEC_free components. (distribute_loop): Update call to build_rdg. Allocate and free loop_nest, datarefs, and dependence_relations. * tree-loop-linear.c (linear_transform_loops): Allocate and free loop_nest. * tree-parloops.c (loop_parallel_p): Same. * tree-predcom.c (tree_predictive_commoning_loop): Same. * tree-vect-data-refs.c (vect_analyze_data_refs): Pass to compute_data_dependences_for_loop a pointer to LOOP_VINFO_LOOP_NEST. * tree-vect-loop.c (new_loop_vec_info): Initialize LOOP_VINFO_LOOP_NEST. (destroy_loop_vec_info): Free LOOP_VINFO_MAY_ALIAS_DDRS and LOOP_VINFO_LOOP_NEST. * tree-vect-slp.c (destroy_bb_vec_info): Call free_data_refs and free_dependence_relations. * tree-vectorizer.h (struct _loop_vec_info): Add a field loop_nest. (LOOP_VINFO_LOOP_NEST): New. From-SVN: r168210
2010-11-24common.opt (user_vect_verbosity_level): New Variable entry.Joseph Myers1-17/+1
* common.opt (user_vect_verbosity_level): New Variable entry. (ftree-vectorizer-verbose=): Mark as UInteger. * flag-types.h (enum vect_verbosity_levels): Move from enum verbosity_levels in tree-vectorizer.h. * opts.c: Don't include tree.h. (vect_set_verbosity_level): Move from tree-vectorizer.c. Use gcc_options parameter; take integer option argument. (common_handle_option): Update call to vect_set_verbosity_level. * tree-vectorizer.c (user_vect_verbosity_level): Remove. (vect_set_verbosity_level): Move to opts.c. (vect_verbosity_level, vect_print_dump_info): Update for change of enum name. * tree-vectorizer.h (enum verbosity_levels): Move to flag-types.h. (vect_print_dump_info): Update for change of enum name. * tree.h (vect_set_verbosity_level): Remove. * Makefile.in (opts.o): Update dependencies. From-SVN: r167113
2010-10-21re PR tree-optimization/46049 (ICE: in expand_widen_pattern_expr, at ↵Ira Rosen1-1/+2
optabs.c:522 with -ftree-vectorize) PR tree-optimization/46049 PR tree-optimization/46052 * tree-vectorizer.h (enum stmt_vec_info_type): Add new value for shift. (vect_get_slp_defs): Add arguments. * tree-vect-loop.c (vect_create_epilog_for_reduction): Pass scalar operands to vect_get_slp_defs. (vectorizable_reduction): Fix comment, pass scalar operands to vect_get_slp_defs. * tree-vect-stmts.c (vect_get_vec_def_for_operand): Use operand's type to determine number of units in the created vector. (vect_get_vec_defs): Pass scalar operands to vect_get_slp_defs. (vectorizable_conversion): Fix comment. (vectorizable_shift): New function. (vectorizable_operation): Move code that handles shifts to vectorizable_shift. (vectorizable_type_demotion): Fix comment, pass scalar operands to vect_get_slp_defs. (vectorizable_type_promotion, vectorizable_store): Likewise. (vectorizable_condition): Fix comment. (vect_analyze_stmt): Call vectorizable_shift. (vect_transform_stmt): Likewise. * tree-vect-slp.c (vect_get_constant_vectors): Add new argument. Use it as the operand to create vectors for, except reduction initial definition and store. Use operands type. (vect_get_slp_defs): Add new arguments. Pass them to vect_get_constant_vectors. From-SVN: r165777
2010-10-07machmode.h (mode_for_vector): Declare.Richard Guenther1-0/+1
2010-10-07 Richard Guenther <rguenther@suse.de> * machmode.h (mode_for_vector): Declare. * stor-layout.c (mode_for_vector): New function, split out from ... (layout_type): ... here. * tree-vectorizer.h (current_vector_size): Declare. * tree-vect-stmts.c (perm_mask_for_reverse): Check if the mask vector type is available. (get_vectype_for_scalar_type): Rename to ... (get_vectype_for_scalar_type_and_size): ... this. Get a vector size argument. (get_vectype_for_scalar_type): New wrapper around get_vectype_for_scalar_type_and_size using current_vector_size. (get_same_sized_vectype): Use get_vectype_for_scalar_type_and_size. * tree-vect-loop.c (vect_analyze_loop_2): Split out core part of vect_analyze_loop here. (vect_analyze_loop): Loop over vector sizes calling vect_analyze_loop_3. * tree-vect-slp.c (vect_slp_analyze_bb): Set current_vector_size to autodetect. * config/i386/i386.c (ix86_vectorize_builtin_conversion): Fix V8SF to V8SI conversion builtin. From-SVN: r165116
2010-09-16tree-vectorizer.c: Fix documentation.Ira Rosen1-0/+24
* tree-vectorizer.c: Fix documentation. * tree-vectorizer.h (vinfo_for_stmt): Add documentation. (set_vinfo_for_stmt, get_earlier_stmt, get_later_stmt, is_pattern_stmt_p, is_loop_header_bb_p, stmt_vinfo_set_inside_of_loop_cost, stmt_vinfo_set_outside_of_loop_cost, vect_pow2, aligned_access_p, known_alignment_for_access_p): Likewise. * tree-vect-loop.c: Fix documentation. (vect_get_cost): Start function name from new line. * tree-vect-data-refs.c: Fix documentation. * tree-vect_stmts.c: Likewise. (vect_create_vectorized_promotion_stmts): Always free vec_tmp. (vectorizable_store): Free vec_oprnds if allocated. (vectorizable_condition): Initialize several variables to avoid warnings. * tree-vect-slp.c: Fix documentation. From-SVN: r164332
2010-09-02tree-vectorizer.h (get_later_stmt): New function.Ira Rosen1-1/+27
* tree-vectorizer.h (get_later_stmt): New function. (vect_analyze_data_ref_dependences): Add argument. * tree-vect-loop.c (vect_analyze_loop): Update call to vect_analyze_data_ref_dependences. * tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): New function. (vect_analyze_data_ref_dependence): Add argument for basic block dependencies. Check dependencies in basic block vectorization. (vect_analyze_data_ref_dependences): Add argument and update call to vect_analyze_data_ref_dependences. * tree-vect-slp.c (vect_find_last_store_in_slp_instance): New. (vect_bb_vectorizable_with_dependencies): New. (vect_slp_analyze_bb): Check dependencies in basic block. (vect_schedule_slp_instance): Insert stores before the last store in SLP instance. From-SVN: r163757
2010-07-04tm.texi.in (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Document new ↵Ira Rosen1-2/+28
arguments. * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Document new arguments. * doc/tm.texi: Regenerate. * targhooks.c (default_builtin_vectorization_cost): Add new arguments. Handle unaligned store. * targhooks.h (default_builtin_vectorization_cost): Add new arguments. * target.def (builtin_vectorization_cost): Add new arguments. * target.h (enum vect_cost_for_stmt): Add unaligned_store. * tree-vect-loop-manip.c (vect_gen_niters_for_prolog_loop): Take number of iterations of prolog loop directly from LOOP_PEELING_FOR_ALIGNMENT. (vect_vfa_segment_size): Fix indentation. * tree-vectorizer.h (struct _vect_peel_info): New. (struct _vect_peel_extended_info): New. (struct _loop_vec_info): Add new field for peeling hash table and a macro for its access. (VECT_MAX_COST): Define. (vect_get_load_cost): Declare. (vect_get_store_cost, vect_get_known_peeling_cost, vect_get_single_scalar_iteraion_cost): Likewise. (vect_supportable_dr_alignment): Add new argument. * tree-vect-loop.c (new_loop_vec_info): Initialize peeling hash table field. (destroy_loop_vec_info): Free peeling hash table. (vect_analyze_loop_form): Update call to builtin_vectorization_cost. (vect_analyze_loop): Move vect_enhance_data_refs_alignment before vect_analyze_slp. Fix indentation. (vect_get_single_scalar_iteraion_cost): New function. (vect_get_known_peeling_cost): Likewise. (vect_estimate_min_profitable_iters): Rename byte_misalign to npeel. Call vect_get_single_scalar_iteraion_cost instead of cost_for_stmt per statement. Move outside cost calculation inside unknown peeling case. Call vect_get_known_peeling_cost for known amount of peeling. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Add data reference to the print message of forced alignment. (vect_verify_datarefs_alignment): Update call to vect_supportable_dr_alignment. (vect_get_data_access_cost): New function. (vect_peeling_hash, vect_peeling_hash_eq, vect_peeling_hash_insert, vect_peeling_hash_get_most_frequent, vect_peeling_hash_get_lowest_cost, vect_peeling_hash_choose_best_peeling): Likewise. (vect_enhance_data_refs_alignment): Fix documentation. Use hash table to store all the accesses in the loop and find best possible access to align using peeling for known alignment case. For unknown alignment check if stores are preferred or if peeling is worthy. (vect_find_same_alignment_drs): Analyze pairs of loads too. (vect_supportable_dr_alignment): Add new argument and check aligned accesses according to it. * tree-vect-stmts.c (vect_get_stmt_cost): New function. (cost_for_stmt): Call vect_get_stmt_cost. (vect_model_simple_cost): Likewise. (vect_model_store_cost): Call vect_get_stmt_cost. Call vect_get_store_cost to calculate the cost of the statement. (vect_get_store_cost): New function. (vect_model_load_cost): Call vect_get_stmt_cost. Call vect_get_load_cost to calculate the cost of the statement. (vect_get_load_cost): New function. (vectorizable_store): Update call to vect_supportable_dr_alignment. (vectorizable_load): Likewise. * config/spu/spu.c (spu_builtin_vectorization_cost): Add new arguments. * config/i386/i386.c (ix86_builtin_vectorization_cost): Add new arguments. Handle unaligned store. * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): New. (rs6000_builtin_support_vector_misalignment): Return true for word and double word alignments for VSX. * tree-vect-slp.c (vect_build_slp_tree): Update calls to vect_supportable_dr_alignment and builtin_vectorization_cost. Co-Authored-By: Revital Eres <eres@il.ibm.com> From-SVN: r161797
2010-06-09cgraph.h (varpool_first_static_initializer, [...]): Make checking only when ↵Jan Hubicka1-5/+4
checking enabled. * cgraph.h (varpool_first_static_initializer, varpool_next_static_initializer): Make checking only when checking enabled. * tree-vectorizer.h (vinfo_for_stmt): Remove check. (set_vinfo_for_stmt, get_earlier_stmt, is_loop_header_bb_p): Change gcc_assert to gcc_checking_assert. * tree-flow-inline.h (gimple_vop, get_var_ann, relink_imm_use, phi_nodes set_phi_nodes, phi_arg_index_from_use, op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init, op_iter_init_use, op_iter_init_phiuse, op_iter_init_phidef, array_ref_contains_indirect_ref, ref_contains_array_ref): Use gcc_checking_assert. * emit-rtl.h (set_first_insn, set_last_insn): Likewise. * tree-ssa-live.h (var_to_partition, var_to_partition_to_var, partition_is_global, live_on_entry, live_on_exit, live_merge_and_clear): Likewise. * system.h (gcc_checking_assert): New macro. From-SVN: r160489
2010-06-07tm.texi (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Update documentation.Ira Rosen1-64/+0
* doc/tm.texi (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Update documentation. * targhooks.c (default_builtin_vectorization_cost): New function. * targhooks.h (default_builtin_vectorization_cost): Declare. * target.h (enum vect_cost_for_stmt): Define. (builtin_vectorization_cost): Change argument and comment. * tree-vectorizer.h: Remove cost model macros. * tree-vect-loop.c: Include target.h. (vect_get_cost): New function. (vect_estimate_min_profitable_iters): Replace cost model macros with calls to vect_get_cost. (vect_model_reduction_cost, vect_model_induction_cost): Likewise. * target-def.h (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Add default implementation. * tree-vect-stmts.c (cost_for_stmt): Replace cost model macros with calls to target hook builtin_vectorization_cost. (vect_model_simple_cost, vect_model_store_cost, vect_model_load_cost): Likewise. * Makefile.in (tree-vect-loop.o): Add dependency on TARGET_H. * config/spu/spu.c (spu_builtin_vectorization_cost): Replace with new implementation to return costs. * config/i386/i386.c (ix86_builtin_vectorization_cost): Likewise. * config/spu/spu.h: Remove vectorizer cost model macros. * config/i386/i386.h: Likewise. * tree-vect-slp.c (vect_build_slp_tree): Replace cost model macro with a call to target hook builtin_vectorization_cost. From-SVN: r160360
2010-05-10tree-ssa-reassoc.c (undistribute_ops_list): Use create_tmp_reg.Michael Matz1-1/+1
* tree-ssa-reassoc.c (undistribute_ops_list): Use create_tmp_reg. (can_reassociate_p): Use FLOAT_TYPE_P. * tree-vectorizer.h (vect_is_simple_reduction): Rename to ... (vect_force_simple_reduction): ... this. * tree-parloops.c (gather_scalar_reductions): Use vect_force_simple_reduction. * tree-vect-loop.c (vect_is_simple_reduction_1): Rename from vect_is_simple_reduction, add modify argument, if true rewrite "a-b" into "a+(-b)". (vect_is_simple_reduction, vect_force_simple_reduction): New functions. (vect_analyze_scalar_cycles_1): Use vect_force_simple_reduction. testsuite/ * gcc.dg/vect/fast-math-vect-reduc-8.c: New test. From-SVN: r159226
2010-04-26cfgloop.h (struct loop): Move can_be_parallel field up.Nathan Froyd1-24/+25
* cfgloop.h (struct loop): Move can_be_parallel field up. * ipa-prop.h (struct ip_node_params): Move bitfields up. * tree-ssa-loop-ivopts.c (struct version_info): Move inv_id field down. (struct iv_cand): Convert pos field into a bitfield. * tree-vectorizer.h (struct _loop_vec_info): Move loop_line_number field up. (struct _stmt_vec_info): Shuffle fields for better packing. From-SVN: r158743
2010-04-26tree-vectorizer.h (struct _stmt_vec_info): Add new field to determine if the ↵Ira Rosen1-0/+5
statement is vectorizable... * tree-vectorizer.h (struct _stmt_vec_info): Add new field to determine if the statement is vectorizable, and a macro to access it. * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Skip statements that can't be vectorized. If the analysis fails, mark the statement as unvectorizable if vectorizing basic block. (vect_compute_data_refs_alignment): Likewise. (vect_verify_datarefs_alignment): Skip statements marked as unvectorizable. Add print. (vect_analyze_group_access): Skip statements that can't be vectorized. If the analysis fails, mark the statement as unvectorizable if vectorizing basic block. (vect_analyze_data_ref_accesses, vect_analyze_data_refs): Likewise. * tree-vect-stmts.c (vectorizable_store): Fix the number of generated stmts for SLP. (new_stmt_vec_info): Initialize the new field. * tree-vect-slp.c (vect_build_slp_tree): Fail to vectorize statements marked as unvectorizable. From-SVN: r158719
2010-04-19re PR tree-optimization/37027 (SLP loop vectorization missing support for ↵Ira Rosen1-2/+7
reductions) PR tree-optimization/37027 * tree-vectorizer.h (struct _loop_vec_info): Add new field reductions and macro to access it. (vectorizable_reduction): Add argument. (vect_get_slp_defs): Likewise. * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Collect reduction statements for possible use in SLP. (new_loop_vec_info): Initialize LOOP_VINFO_REDUCTIONS. (destroy_loop_vec_info): Free LOOP_VINFO_REDUCTIONS. (vect_create_epilog_for_reduction): Handle SLP. Modify documentation, add new argument. (vectorizable_reduction): Likewise. * tree-vect-stmts.c (vect_get_vec_defs): Update call to vect_get_slp_defs. (vectorizable_type_demotion, vectorizable_type_promotion, vectorizable_store): Likewise. (vect_analyze_stmt): Update call to vectorizable_reduction. (vect_transform_stmt): Likewise. * tree-vect-slp.c (vect_get_and_check_slp_defs): Handle reduction. (vect_build_slp_tree): Fix indentation. Check that there are no loads from different interleaving chains in same node. (vect_slp_rearrange_stmts): New function. (vect_supported_load_permutation_p): Allow load permutations for reductions. Call vect_slp_rearrange_stmts() to rearrange statements inside SLP nodes if necessary. (vect_analyze_slp_instance): Handle reductions. (vect_analyze_slp): Try to build SLP instances originating from groups of reductions. (vect_detect_hybrid_slp_stmts): Skip reduction statements. (vect_get_constant_vectors): Create initial vectors for reductions according to reduction code. Add new argument. (vect_get_slp_defs): Add new argument, pass it to vect_get_constant_vectors. (vect_schedule_slp_instance): Remove SLP tree root statements. From-SVN: r158506
2010-04-13tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Only add RW ↵Richard Guenther1-2/+6
dependence for dependence distance zero. 2010-04-13 Richard Guenther <rguenther@suse.de> * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Only add RW dependence for dependence distance zero. Adjust maximal vectorization factor according to dependences. Move alignment handling ... (vect_find_same_alignment_drs): ... here. New function. (vect_analyze_data_ref_dependences): Adjust. (vect_analyze_data_refs_alignment): Call vect_find_same_alignment_drs. (vect_analyze_data_refs): Adjust minimal vectorization factor according to data references. * tree-vect-loop.c (vect_analyze_loop): Analyze data-ref dependences before determining the vectorization factor. Analyze alignment after determining the vectorization factor. * tree-vect-slp.c ((vect_slp_analyze_bb): Analyze data-ref dependences before alignment. * tree-vectorizer.h (vect_analyze_data_ref_dependences): Adjust prototype. (vect_analyze_data_refs): Likewise. (MAX_VECTORIZATION_FACTOR): New define. * gcc.dg/vect/no-vfa-vect-depend-1.c: Adjust. From-SVN: r158259
2010-04-09tree-vectorizer.h (struct _stmt_vec_info): Document that vectype is the type ↵Richard Guenther1-5/+8
of the LHS. 2010-04-09 Richard Guenther <rguenther@suse.de> * tree-vectorizer.h (struct _stmt_vec_info): Document that vectype is the type of the LHS. (supportable_widening_operation, supportable_narrowing_operation): Get both input and output vector types as arguments. (vect_is_simple_use_1): Declare. (get_same_sized_vectype): Likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): Set STMT_VINFO_VECTYPE to the vector type of the def. (vectorizable_reduction): Adjust. * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Adjust. Specify the output vector type. (vect_pattern_recog_1): Adjust. * tree-vect-stmts.c (get_same_sized_vectype): New function. (vectorizable_call): Adjust. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_type_promotion): Likewise. (vect_analyze_stmt): Set STMT_VINFO_VECTYPE to the vector type of the def. (vect_is_simple_use_1): New function. (supportable_widening_operation): Get both input and output vector types. (supportable_narrowing_operation): Likewise. * tree-vect-slp.c (vect_schedule_slp_instance): Adjust. From-SVN: r158157
2010-04-02Make-lang.in, [...]: Update copyright years.Steven Bosscher1-2/+2
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h, collect2.h, config/alpha/alpha.c, config/alpha/alpha.md, config/alpha/predicates.md, config/arm/arm.md, config/arm/lib1funcs.asm, config/arm/neon-schedgen.ml, config/avr/avr.c, config/avr/avr.md, config/bfin/bfin.c, config/darwin9.h, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cpuid.h, config/i386/cygming.h, config/i386/cygwin.h, config/i386/mingw32.h, config/i386/msformat-c.c, config/i386/sol2-10.h, config/i386/xopintrin.h, config/ia64/ia64.c, config/ia64/ia64.md, config/ia64/sync.md, config/mep/mep.c, config/mips/mips.md, config/mn10300/mn10300.c, config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.md, config/rs6000/aix.h, config/rs6000/dfp.md, config/rs6000/rs6000-builtin.def, config/rs6000/rs6000-c.c, config/rs6000/vector.md, config/rtems.h, config/rx/rx.md, config/s390/s390.md, config/sol2-c.c, config/sparc/sol2-bi.h, config/sparc/sol2-gas.h, config/sparc/sparc.h, config/sparc/sparc.md, config/sparc/sparc-protos.h, config/spu/spu.c, config/spu/spu-c.c, config/t-darwin, convert.c, c.opt, c-opts.c, cp/Make-lang.in, c-pretty-print.c, c-typeck.c, df-core.c, df-scan.c, diagnostic.c, diagnostic.h, doc/cppopts.texi, doc/cpp.texi, doc/extend.texi, doc/gimple.texi, doc/languages.texi, doc/plugins.texi, doc/rtl.texi, doc/standards.texi, doc/tree-ssa.texi, doc/trouble.texi, dominance.c, fold-const.c, fortran/Make-lang.in, fwprop.c, gcc-plugin.h, gensupport.c, gimple.h, gimple-iterator.c, graphite.c, graphite-clast-to-gimple.c, graphite-clast-to-gimple.h, graphite-dependences.c, graphite-poly.c, graphite-poly.h, graphite-ppl.c, graphite-ppl.h, graphite-scop-detection.c, graphite-sese-to-poly.c, graphite-sese-to-poly.h, ifcvt.c, intl.c, intl.h, ipa.c, ipa-cp.c, ipa-inline.c, ipa-prop.c, ipa-prop.h, ipa-pure-const.c, ipa-reference.c, ipa-type-escape.c, ira-color.c, ira-conflicts.c, ira-lives.c, java/Make-lang.in, lambda-code.c, loop-invariant.c, lto/Make-lang.in, lto-streamer.h, lto-streamer-in.c, objc/Make-lang.in, objcp/Make-lang.in, omp-low.c, optc-gen.awk, opt-functions.awk, opth-gen.awk, params.def, passes.c, postreload-gcse.c, print-tree.c, recog.c, regrename.c, reload.h, rtl.def, sched-int.h, sched-rgn.c, sel-sched-dump.c, sese.c, sese.h, store-motion.c, stor-layout.c, tree-cfgcleanup.c, tree-chrec.c, tree-complex.c, tree-data-ref.c, tree.def, tree-eh.c, tree-flow.h, tree-flow-inline.h, tree.h, tree-loop-distribution.c, tree-outof-ssa.c, tree-parloops.c, tree-pass.h, tree-predcom.c, tree-profile.c, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-alias.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-manip.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-pre.c, tree-ssa-sccvn.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.h, tree-vect-slp.c, tree-vrp.c, unwind-dw2-fde-darwin.c, varpool.c: Update copyright years. From-SVN: r157950
2010-02-16re PR tree-optimization/43074 (ICE in vectorizable_reduction, at ↵Ira Rosen1-0/+4
tree-vect-loop.c:3491) PR tree-optimization/43074 * tree-vectorizer.h (VECTORIZABLE_CYCLE_DEF): New. * tree-vect-loop.c (vect_analyze_loop_operations): Add vectorizable cycles in hybrid SLP check. * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Likewise. From-SVN: r156800