gcc/gcc/tree-vectorizer.h

548 lines
19 KiB
C
Raw Normal View History

tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/* Loop Vectorization
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
Contributed by Dorit Naishlos <dorit@il.ibm.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
#ifndef GCC_TREE_VECTORIZER_H
#define GCC_TREE_VECTORIZER_H
tree-vectorizer.h (LOC): New type. * tree-vectorizer.h (LOC): New type. (UNKNOWN_LOC, EXPR_LOC, LOC_FILE, LOC_LINE): New macros. (loop_line_number): New field in struct _loop_vec_info. (LOOP_VINFO_LOC, LOOP_LOC): New macros. * tree-vectorizer.c (input.h): Included. (find_loop_location): New function. (vect_debug_stats): Argument changed from loop to LOC. Computation of loop line number removed. (vect_debug_details): Likewise. (new_loop_vec_info): Initialize new field LOOP_VINFO_LOC. (slpeel_make_loop_iterate_ntimes): Call find_loop_location. Argument in call to vect_debug_details/stats changed from loop to loop_loc. (slpeel_tree_duplicate_loop_to_edge_cfg): Likewise. (slpeel_tree_peel_loop_to_edge): Likewise. (vect_analyze_offset_expr): Argument in call to vect_debug_details/stats changed from NULL to UNKNOWN_LOC. (vect_get_base_and_offset): (vect_create_addr_base_for_vector_ref): (get_vectype_for_scalar_type): (vect_create_data_ref_ptr): (vect_init_vector): (vect_get_vec_def_for_operand): (vect_finish_stmt_generation): (vectorizable_assignment): (vectorizable_operation): (vectorizable_store): (vectorizable_load): (vect_transform_stmt): (vect_update_ivs_after_vectorizer): (vect_do_peeling_for_loop_bound): (vect_do_peeling_for_alignment): (vect_transform_loop): (vect_is_simple_use): (vect_analyze_operations): (vect_is_simple_iv_evolution): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependences): (vect_compute_data_ref_alignment): (vect_enhance_data_refs_alignment): (vect_analyze_data_ref_access): (vect_analyze_data_ref_accesses): (vect_analyze_pointer_ref_access): (vect_get_memtag_and_dr): (vect_analyze_data_refs): (vect_mark_relevant): (vect_stmt_relevant_p): (vect_mark_stmts_to_be_vectorized): (vect_can_advance_ivs_p): (vect_get_loop_niters): (vect_analyze_loop): (vectorize_loops): Likewise. (vectorizable_load): Argument in call to vect_debug_details/stats changed from loop to LOOP_LOC (loop_vinfo). (vect_transform_loop): (vect_analyze_operations): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependence): (vect_enhance_data_refs_alignment): (vect_analyze_data_ref_accesses): (vect_analyze_pointer_ref_access): (vect_analyze_data_refs): (vect_analyze_loop): Likewise. (vect_analyze_loop_form): Argument in call to vect_debug_details/stats changed from loop to loop_loc. (vect_enhance_data_refs_alignment): Removed unused variable loop. From-SVN: r94662
2005-02-03 17:22:22 +01:00
#ifdef USE_MAPPED_LOCATION
typedef source_location LOC;
#define UNKNOWN_LOC UNKNOWN_LOCATION
#define EXPR_LOC(e) EXPR_LOCATION(e)
#define LOC_FILE(l) LOCATION_FILE (l)
#define LOC_LINE(l) LOCATION_LINE (l)
#else
typedef source_locus LOC;
#define UNKNOWN_LOC NULL
#define EXPR_LOC(e) EXPR_LOCUS(e)
#define LOC_FILE(l) (l)->file
#define LOC_LINE(l) (l)->line
#endif
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/* Used for naming of new temporaries. */
enum vect_var_kind {
vect_simple_var,
tree.def (REDUC_MAX_EXPR, [...]): New tree-codes. * tree.def (REDUC_MAX_EXPR, REDUC_MIN_EXPR, REDUC_PLUS_EXPR): New tree-codes. * optabs.h (OTI_reduc_smax, OTI_reduc_umax, OTI_reduc_smin, OTI_reduc_umin, OTI_reduc_plus): New optabs for reduction. (reduc_smax_optab, reduc_umax_optab, reduc_smin_optab, reduc_umin_optab, reduc_plus_optab): New optabs for reduction. * expr.c (expand_expr_real_1): Handle new tree-codes. * tree-inline.c (estimate_num_insns_1): Handle new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio, op_symbol): Handle new tree-codes. * optabs.c (optab_for_tree_code): Handle new tree-codes. (init_optabs): Initialize new optabs. * genopinit.c (optabs): Define handlers for new optabs. * tree-vect-analyze.c (vect_analyze_operations): Fail vectorization in case of a phi that is marked as relevant. Call vectorizable_reduction. (vect_mark_relevant): Phis may be marked as relevant. (vect_mark_stmts_to_be_vectorized): The use corresponding to the reduction variable in a reduction stmt does not mark its defining phi as relevant. Update documentation accordingly. (vect_can_advance_ivs_p): Skip reduction phis. * tree-vect-transform.c (vect_get_vec_def_for_operand): Takes additional argument. Handle reduction. (vect_create_destination_var): Update call to vect_get_new_vect_var. Handle non-vector argument. (get_initial_def_for_reduction): New function. (vect_create_epilog_for_reduction): New function. (vectorizable_reduction): New function. (vect_get_new_vect_var): Handle new vect_var_kind. (vectorizable_assignment, vectorizable_operation, vectorizable_store, vectorizable_condition): Update call to vect_get_new_vect_var. (vect_transform_stmt): Call vectorizable_reduction. (vect_update_ivs_after_vectorizer): Skip reduction phis. (vect_transform_loop): Skip if stmt is both not relevant and not live. * tree-vectorizer.c (reduction_code_for_scalar_code): New function. (vect_is_simple_reduction): Was empty - added implementation. * tree-vectorizer.h (vect_scalar_var): New enum vect_var_kind value. (reduc_vec_info_type): New enum vect_def_type value. * config/rs6000/altivec.md (reduc_smax_v4si, reduc_smax_v4sf, reduc_umax_v4si, reduc_smin_v4si, reduc_umin_v4sf, reduc_smin_v4sf, reduc_plus_v4si, reduc_plus_v4sf): New define_expands. * tree-vect-analyze.c (vect_determine_vectorization_factor): Remove ENABLE_CHECKING around gcc_assert. * tree-vect-transform.c (vect_do_peeling_for_loop_bound, (vect_do_peeling_for_alignment, vect_transform_loop, vect_get_vec_def_for_operand): Likewise. From-SVN: r101155
2005-06-18 15:18:52 +02:00
vect_pointer_var,
vect_scalar_var
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
};
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
/* Defines type of operation. */
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
enum operation_type {
unary_op = 1,
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
binary_op,
ternary_op
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
};
re PR tree-optimization/18009 (ICE in vect_transform_stmt, at tree-vectorizer.c:2625 (testcase included)) PR tree-optimization/18009 * tree-vectorizer.h (enum dr_alignment_support): New type. (MAX_NUMBER_OF_UNALIGNED_DATA_REFS): Removed. (LOOP_UNALIGNED_DR): replaced with LOOP_VINFO_UNALIGNED_DR and holds a single data_reference (instead of a varray of references). * tree-vectorizer.c (new_loop_vec_info): Likewise. (vect_gen_niters_for_prolog_loop): Likewise. (vect_update_inits_of_drs): Likewise. (vect_update_inits_of_drs): Setting of DR_MISALIGNMENT moved to vect_enhance_data_refs_alignment. (vect_do_peeling_for_alignment): Likewise. (vect_enhance_data_refs_alignment): Decide if and by how much to peel; this functionality used to be in vect_analyze_data_refs_alignment. Also update DR_MISALIGNMENT due to peeling; this functionality used to be in vect_update_inits_of_drs and vect_do_peeling_for_alignment). (vect_analyze_data_refs_alignment): Decision on whether and by how much to peel moved to vect_enhance_data_refs_alignment. Call vect_supportable_dr_alignment. (vect_compute_data_ref_alignment): Set STMT_VINFO_VECTYPE. (vect_compute_data_refs_alignment): Return bool. Consider return value of vect_compute_data_ref_alignment and return true/false accordingly. (vect_enhance_data_refs_alignment): Consider return value of vect_compute_data_refs_alignment and return true/false accordingly. (vect_supportable_dr_alignment): New function. (vectorizable_store): Call vect_supportable_dr_alignment. (vectorizable_load): Call vect_supportable_dr_alignment. Alignment support checks moved from here to vect_supportable_dr_alignment. (vect_transform_loop): Avoid 80 columns overflow. From-SVN: r90051
2004-11-04 06:26:53 +01:00
/* Define type of available alignment support. */
enum dr_alignment_support {
dr_unaligned_unsupported,
dr_unaligned_supported,
dr_unaligned_software_pipeline,
dr_aligned
};
/* Define type of def-use cross-iteration cycle. */
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
enum vect_def_type {
vect_constant_def,
vect_invariant_def,
vect_loop_def,
vect_induction_def,
vect_reduction_def,
vect_unknown_def_type
};
invoke.texi (ftree-vectorizer-verbose): New. * doc/invoke.texi (ftree-vectorizer-verbose): New. * opts.c (OPT_ftree_vectorizer_verbose_): New case for switch. * common.opt (ftree-vectorizer-verbose): New Flag for the vectorizer was added. * tree.h (vect_set_verbosity_level): New extern function declaration added. * tree-vectorizer.h (verbosity_levels): New enum type. * tree-vectorizer.c (vect_debug_stats): Function removed. (vect_debug_details): Likewise. (vect_verbosity_level): Global variable was defined and initialized. (vect_dump): Global variable definition. (vect_print_dump_info): New function. (vect_set_dump_settings): New function. (vect_set_verbosity_level): New function. (vectorize_loops): Add call to vect_set_dump_settings. (slpeel_make_loop_iterate_ntimes): Dump condition was changed. (slpeel_tree_duplicate_loop_to_edge_cfg): Likewise. (slpeel_tree_peel_loop_to_edge): Likewise. (vect_analyze_offset_expr): Call to vect_print_dump_info with appropriate verbosity level instead of call to vect_debug_details or vect_debug_stats. (vect_get_base_and_offset): (vect_create_addr_base_for_vector_ref): (get_vectype_for_scalar_type): (vect_create_data_ref_ptr): (vect_init_vector): (vect_get_vec_def_for_operand): (vect_finish_stmt_generation): (vectorizable_assignment): (vectorizable_operation): (vectorizable_store): (vectorizable_load): (vect_transform_stmt): (vect_update_ivs_after_vectorizer): (vect_do_peeling_for_loop_bound): (vect_update_inits_of_drs): (vect_do_peeling_for_alignment): (vect_transform_loop): (vect_is_simple_use): (vect_analyze_operations): (vect_is_simple_iv_evolution): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependence): (vect_analyze_data_ref_dependences): (vect_compute_data_ref_alignment): (vect_enhance_data_refs_alignment): (vect_analyze_data_refs_alignment): (vect_analyze_data_ref_access): (vect_analyze_data_ref_accesses): (vect_analyze_pointer_ref_access): (vect_get_memtag_and_dr): (vect_analyze_data_refs): (vect_mark_relevant): (vect_stmt_relevant_p): (vect_mark_stmts_to_be_vectorized): (vect_can_advance_ivs_p): (vect_get_loop_niters): (vect_analyze_loop_form): (vect_analyze_loop): (vectorize_loops): Likewise. (vect_do_peeling_for_loop_bound): Dump format slightly changed. (vect_update_inits_of_drs): (vect_do_peeling_for_alignment): (vect_transform_loop): (vect_analyze_operations): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependences): (vect_analyze_data_refs_alignment): (vect_analyze_data_ref_accesses): (vect_analyze_data_refs): (vect_mark_stmts_to_be_vectorized): (vect_get_loop_niters): (vect_analyze_loop_form): (vect_analyze_loop): Likewise. (vect_mark_stmts_to_be_vectorized): Add call to print_generic_expr. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94697
2005-02-07 11:07:07 +01:00
/* Define verbosity levels. */
enum verbosity_levels {
REPORT_NONE,
REPORT_VECTORIZED_LOOPS,
REPORT_UNVECTORIZED_LOOPS,
REPORT_ALIGNMENT,
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
REPORT_DR_DETAILS,
invoke.texi (ftree-vectorizer-verbose): New. * doc/invoke.texi (ftree-vectorizer-verbose): New. * opts.c (OPT_ftree_vectorizer_verbose_): New case for switch. * common.opt (ftree-vectorizer-verbose): New Flag for the vectorizer was added. * tree.h (vect_set_verbosity_level): New extern function declaration added. * tree-vectorizer.h (verbosity_levels): New enum type. * tree-vectorizer.c (vect_debug_stats): Function removed. (vect_debug_details): Likewise. (vect_verbosity_level): Global variable was defined and initialized. (vect_dump): Global variable definition. (vect_print_dump_info): New function. (vect_set_dump_settings): New function. (vect_set_verbosity_level): New function. (vectorize_loops): Add call to vect_set_dump_settings. (slpeel_make_loop_iterate_ntimes): Dump condition was changed. (slpeel_tree_duplicate_loop_to_edge_cfg): Likewise. (slpeel_tree_peel_loop_to_edge): Likewise. (vect_analyze_offset_expr): Call to vect_print_dump_info with appropriate verbosity level instead of call to vect_debug_details or vect_debug_stats. (vect_get_base_and_offset): (vect_create_addr_base_for_vector_ref): (get_vectype_for_scalar_type): (vect_create_data_ref_ptr): (vect_init_vector): (vect_get_vec_def_for_operand): (vect_finish_stmt_generation): (vectorizable_assignment): (vectorizable_operation): (vectorizable_store): (vectorizable_load): (vect_transform_stmt): (vect_update_ivs_after_vectorizer): (vect_do_peeling_for_loop_bound): (vect_update_inits_of_drs): (vect_do_peeling_for_alignment): (vect_transform_loop): (vect_is_simple_use): (vect_analyze_operations): (vect_is_simple_iv_evolution): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependence): (vect_analyze_data_ref_dependences): (vect_compute_data_ref_alignment): (vect_enhance_data_refs_alignment): (vect_analyze_data_refs_alignment): (vect_analyze_data_ref_access): (vect_analyze_data_ref_accesses): (vect_analyze_pointer_ref_access): (vect_get_memtag_and_dr): (vect_analyze_data_refs): (vect_mark_relevant): (vect_stmt_relevant_p): (vect_mark_stmts_to_be_vectorized): (vect_can_advance_ivs_p): (vect_get_loop_niters): (vect_analyze_loop_form): (vect_analyze_loop): (vectorize_loops): Likewise. (vect_do_peeling_for_loop_bound): Dump format slightly changed. (vect_update_inits_of_drs): (vect_do_peeling_for_alignment): (vect_transform_loop): (vect_analyze_operations): (vect_analyze_scalar_cycles): (vect_analyze_data_ref_dependences): (vect_analyze_data_refs_alignment): (vect_analyze_data_ref_accesses): (vect_analyze_data_refs): (vect_mark_stmts_to_be_vectorized): (vect_get_loop_niters): (vect_analyze_loop_form): (vect_analyze_loop): Likewise. (vect_mark_stmts_to_be_vectorized): Add call to print_generic_expr. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94697
2005-02-07 11:07:07 +01:00
REPORT_BAD_FORM_LOOPS,
REPORT_OUTER_LOOPS,
REPORT_DETAILS,
/* New verbosity levels should be added before this one. */
MAX_VERBOSITY_LEVEL
};
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
/*-----------------------------------------------------------------*/
/* Info on vectorized loops. */
/*-----------------------------------------------------------------*/
typedef struct _loop_vec_info {
/* The loop to which this info struct refers to. */
struct loop *loop;
/* The loop basic blocks. */
basic_block *bbs;
/* Number of iterations. */
tree num_iters;
tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.h (_loop_vec_info): Added new filed min_profitable_iters. (LOOP_VINFO_COST_MODEL_MIN_ITERS): New access macro to above new field. (TARG_SCALAR_TO_VEC_COST): Define cost of scalar to vector operation. * tree-vect-analyze.c (vect_analyze_operations): Set LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vect-transform.c (vect_estimate_min_profitable_iters): Use VEC_length to determine if there are any LOOP_VINFO_MAY_MISALIGN_STMTS. Fix calculation of peel_iters_prologue. Move consideration of epilogue and prologue cost to after they are computed. (vect_model_induction_cost): Use TARG_SCALAR_TO_VEC_COST instead of TARG_VEC_STMT_COST. (vect_model_simple_cost): Takes additional argument dt. Consider cost of creating vectors from scalars according to dt. (vect_model_store_cost): Likewise. (vectorizable_call): Use dt array instead of scalar dt. Call vect_model_simple_cost with additional argument dt. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_store): Use dt array instead of scalar dt. Call vect_model_store_cost with additional argument dt. (vect_do_peeling_for_loop_bound): Don't call vect_estimate_min_profitable_iters. Instead, lookup LOOP_VINFO_COST_MODEL_MIN_ITERS. Don't always print "may not be profitable". * gcc.dg/vect/costmodel/ppc: New directory. * gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp: New. * gcc.dg/vect/costmodel/ppc/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: Now vectorized. From-SVN: r126368
2007-07-05 15:15:20 +02:00
/* Minimum number of iterations below which vectorization is expected to
not be profitable (as estimated by the cost model).
-1 indicates that vectorization will not be profitable.
FORNOW: This field is an int. Will be a tree in the future, to represent
values unknown at compile time. */
int min_profitable_iters;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
/* Is the loop vectorizable? */
bool vectorizable;
/* Unrolling factor */
int vectorization_factor;
/* Unknown DRs according to which loop was peeled. */
struct data_reference *unaligned_dr;
tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. * tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. (known_alignment_for_access_p): New. (do_peeling_for_alignment): Field made int instead of bool and renamed to peeling_for_alignment. (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to LOOP_PEELING_FOR_ALIGNMENT. * tree-vect-analyze.c (vect_determine_vectorization_factor): New. This functionality used to be in vect_analyze_operations. (vect_analyze_operations): Code to determine vectorization factor was moved to vect_determine_vectorization_factor. (vect_enhance_data_refs_alignment): Update to correct alignment when it is known instead of -1. Set LOOP_PEELING_FOR_ALIGNMENT to peeling factor. (vect_analyze_loop): Call vect_determine_vectorization_factor (used to be part of vect_analyze_operations). * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Use fold when creating the guard condition, as the number of iterations may be constant. (slpeel_tree_peel_loop_to_edge): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. Set it to 0 instead of false. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Handle known alignment case more efficiently. Use LOOP_PEELING_FOR_ALIGNMENT. (vect_do_peeling_for_alignment): Use fold. (vect_transform_loop): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr. (vect_update_inits_of_drs): Use new name of vect_update_inits_of_dr. (vectorizable_store): Fix assertion to use == instead of =. From-SVN: r96526
2005-03-15 19:33:09 +01:00
/* peeling_for_alignment indicates whether peeling for alignment will take
place, and what the peeling factor should be:
peeling_for_alignment = X means:
If X=0: Peeling for alignment will not be applied.
If X>0: Peel first X iterations.
If X=-1: Generate a runtime test to calculate the number of iterations
to be peeled, using the dataref recorded in the field
unaligned_dr. */
int peeling_for_alignment;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
/* The mask used to check the alignment of pointers or arrays. */
int ptr_mask;
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
/* All data references in the loop. */
tree-loop-linear.c: Don't include varray.h. * tree-loop-linear.c: Don't include varray.h. (gather_interchange_stats, try_interchange_loops, linear_transform_loops): Use VEC instead of VARRAY. * lambda-mat.c: Don't include varray.h. * tree-chrec.c: Same. * lambda-trans.c: Same. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use VEC instead of VARRAY. * tree-vectorizer.h: Idem. * tree-data-ref.c (dump_data_references, dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs, initialize_data_dependence_relation, finalize_ddr_dependent, compute_all_dependences, find_data_references_in_loop, compute_data_dependences_for_loop, analyze_all_data_dependences, free_dependence_relation, free_dependence_relations, free_data_refs): Idem. * tree-data-ref.h (data_reference_p, subscript_p): New. (data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use VEC instead of VARRAY. (DDR_SUBSCRIPTS_VECTOR_INIT): Removed. (find_data_references_in_loop, compute_data_dependences_for_loop, dump_ddrs, dump_dist_dir_vectors, dump_data_references, dump_data_dependence_relations, free_dependence_relations, free_data_refs): Adjust declaration. (lambda_transform_legal_p): Move declaration here... * tree-vect-analyze.c (vect_analyze_data_ref_dependences, vect_compute_data_refs_alignment, vect_verify_datarefs_alignment, vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses, vect_analyze_data_refs): Use VEC instead of VARRAY. * lambda.h (lambda_transform_legal_p): ...from here. * lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY. * tree-vect-transform.c (vect_update_inits_of_drs): Idem. * Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o, tree-chrec.o): Don't depend on VARRAY_H. From-SVN: r112437
2006-03-28 06:19:26 +02:00
VEC (data_reference_p, heap) *datarefs;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
/* All data dependences in the loop. */
tree-loop-linear.c: Don't include varray.h. * tree-loop-linear.c: Don't include varray.h. (gather_interchange_stats, try_interchange_loops, linear_transform_loops): Use VEC instead of VARRAY. * lambda-mat.c: Don't include varray.h. * tree-chrec.c: Same. * lambda-trans.c: Same. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use VEC instead of VARRAY. * tree-vectorizer.h: Idem. * tree-data-ref.c (dump_data_references, dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs, initialize_data_dependence_relation, finalize_ddr_dependent, compute_all_dependences, find_data_references_in_loop, compute_data_dependences_for_loop, analyze_all_data_dependences, free_dependence_relation, free_dependence_relations, free_data_refs): Idem. * tree-data-ref.h (data_reference_p, subscript_p): New. (data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use VEC instead of VARRAY. (DDR_SUBSCRIPTS_VECTOR_INIT): Removed. (find_data_references_in_loop, compute_data_dependences_for_loop, dump_ddrs, dump_dist_dir_vectors, dump_data_references, dump_data_dependence_relations, free_dependence_relations, free_data_refs): Adjust declaration. (lambda_transform_legal_p): Move declaration here... * tree-vect-analyze.c (vect_analyze_data_ref_dependences, vect_compute_data_refs_alignment, vect_verify_datarefs_alignment, vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses, vect_analyze_data_refs): Use VEC instead of VARRAY. * lambda.h (lambda_transform_legal_p): ...from here. * lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY. * tree-vect-transform.c (vect_update_inits_of_drs): Idem. * Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o, tree-chrec.o): Don't depend on VARRAY_H. From-SVN: r112437
2006-03-28 06:19:26 +02:00
VEC (ddr_p, heap) *ddrs;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
tree-vectorizer.c (new_loop_vec_info): Initialize new field. gcc/ChangeLog * tree-vectorizer.c (new_loop_vec_info): Initialize new field. (destroy_loop_vec_info): Add call to VEC_free. * tree-vectorizer.h (may_alias_ddrs): Define. (LOOP_VINFO_MAY_ALIAS_DDRS): Define. * tree-vect-analyze.c (vect_analyze_data_ref_dependence): Change reporting to dump. (vect_is_duplicate_ddr): New. (vect_mark_for_runtime_alias_test): New. (vect_analyze_data_ref_dependences) Add call to vect_mark_for_runtime_alias_test. (vect_enhance_data_refs_alignment): Define local variable vect_versioning_for_alias_required, don't perform peeling for alignment if versioning for alias is required. (vect_enhance_data_refs_alignment): Use PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS instead of PARAM_VECT_MAX_VERSION_CHECKS. * tree-vect-transform.c (vect_create_cond_for_alias_checks): New. (vect_transform_loop): Add call to vect_create_cond_for_alias_checks. (vect_vfa_segment_size): New. * params.def (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS): Rename. (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS): Define. * gcc/doc/invoke.texi (vect-max-version-for-alignment-checks): Document. (vect-max-version-for-alias-checks): Document. (vect-max-version-checks): Remove. gcc/testsuite/ChangeLog * gcc.dg/vect/vect-vfa-01.c: New. * gcc.dg/vect/vect-vfa-02.c: New. * gcc.dg/vect/vect-vfa-03.c: New. * gcc.dg/vect/vect-vfa-04.c: New. * gcc.dg/vect/vect-102a.c, gcc.dg/vect/vect-51.c, gcc.dg/vect/pr29145.c, gcc.dg/vect/vect-43.c, gcc.dg/vect/vect-61.c, gcc.dg/vect/vect-53.c, gcc.dg/vect/vect-45.c, gcc.dg/vect/vect-101.c, gcc.dg/vect/vect-37.c, gcc.dg/vect/vect-79.c, gcc.dg/vect/vect-102.c, gcc.dg/vect/vect-dv-2.c, gcc.dg/vect/vect-57.c, gcc.dg/vect/vect-49.c, gfortran.dg/vect/pr19049.f90: Rename to start with prefix no-vfa-. * gcc.dg/vect/vect.exp: Disable versioning for alias when test starts with no-vfa-. * gfortran.dg/vect/vect.exp: Likewise. From-SVN: r127559
2007-08-16 16:20:39 +02:00
/* Data Dependence Relations defining address ranges that are candidates
for a run-time aliasing check. */
VEC (ddr_p, heap) *may_alias_ddrs;
/* Statements in the loop that have data references that are candidates for a
runtime (loop versioning) misalignment check. */
VEC(tree,heap) *may_misalign_stmts;
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
/* The loop location in the source. */
LOC loop_line_number;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
} *loop_vec_info;
/* Access Functions. */
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
#define LOOP_VINFO_LOOP(L) (L)->loop
#define LOOP_VINFO_BBS(L) (L)->bbs
#define LOOP_VINFO_NITERS(L) (L)->num_iters
tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.h (_loop_vec_info): Added new filed min_profitable_iters. (LOOP_VINFO_COST_MODEL_MIN_ITERS): New access macro to above new field. (TARG_SCALAR_TO_VEC_COST): Define cost of scalar to vector operation. * tree-vect-analyze.c (vect_analyze_operations): Set LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vect-transform.c (vect_estimate_min_profitable_iters): Use VEC_length to determine if there are any LOOP_VINFO_MAY_MISALIGN_STMTS. Fix calculation of peel_iters_prologue. Move consideration of epilogue and prologue cost to after they are computed. (vect_model_induction_cost): Use TARG_SCALAR_TO_VEC_COST instead of TARG_VEC_STMT_COST. (vect_model_simple_cost): Takes additional argument dt. Consider cost of creating vectors from scalars according to dt. (vect_model_store_cost): Likewise. (vectorizable_call): Use dt array instead of scalar dt. Call vect_model_simple_cost with additional argument dt. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_store): Use dt array instead of scalar dt. Call vect_model_store_cost with additional argument dt. (vect_do_peeling_for_loop_bound): Don't call vect_estimate_min_profitable_iters. Instead, lookup LOOP_VINFO_COST_MODEL_MIN_ITERS. Don't always print "may not be profitable". * gcc.dg/vect/costmodel/ppc: New directory. * gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp: New. * gcc.dg/vect/costmodel/ppc/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: Now vectorized. From-SVN: r126368
2007-07-05 15:15:20 +02:00
#define LOOP_VINFO_COST_MODEL_MIN_ITERS(L) (L)->min_profitable_iters
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
#define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
#define LOOP_VINFO_DATAREFS(L) (L)->datarefs
#define LOOP_VINFO_DDRS(L) (L)->ddrs
#define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters))
tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. * tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. (known_alignment_for_access_p): New. (do_peeling_for_alignment): Field made int instead of bool and renamed to peeling_for_alignment. (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to LOOP_PEELING_FOR_ALIGNMENT. * tree-vect-analyze.c (vect_determine_vectorization_factor): New. This functionality used to be in vect_analyze_operations. (vect_analyze_operations): Code to determine vectorization factor was moved to vect_determine_vectorization_factor. (vect_enhance_data_refs_alignment): Update to correct alignment when it is known instead of -1. Set LOOP_PEELING_FOR_ALIGNMENT to peeling factor. (vect_analyze_loop): Call vect_determine_vectorization_factor (used to be part of vect_analyze_operations). * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Use fold when creating the guard condition, as the number of iterations may be constant. (slpeel_tree_peel_loop_to_edge): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. Set it to 0 instead of false. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Handle known alignment case more efficiently. Use LOOP_PEELING_FOR_ALIGNMENT. (vect_do_peeling_for_alignment): Use fold. (vect_transform_loop): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr. (vect_update_inits_of_drs): Use new name of vect_update_inits_of_dr. (vectorizable_store): Fix assertion to use == instead of =. From-SVN: r96526
2005-03-15 19:33:09 +01:00
#define LOOP_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
#define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr
#define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
expr.c (highest_pow2_factor): Make extern. * expr.c (highest_pow2_factor): Make extern. * tree-data-ref.c (ptr_decl_may_alias_p): New function. (ptr_ptr_may_alias_p, may_alias_p, record_ptr_differ_p, record_array_differ_p, array_ptr_differ_p): Likewise. (base_object_differ_p): Rename (from array_base_name_differ_p). Support additional cases. Call the above functions. (base_addr_differ_p): Moved from tree-vect-analyze.c. Call base_object_differ_p when there are two base objects. Otherwise, compare base address and offset. Call may_alias_p. (dump_data_reference): Use a correct field name. (analyze_array): Make static. Initialize new data-ref fields. (analyze_indirect_ref): New function. (init_data_ref): Initialize new data-ref fields. (strip_conversion): Moved from tree-vect-analyze.c. (analyze_offset_expr, get_ptr_offset, address_analysis, object_analysis): Likewise. (analyze_offset): New function. (create_data_ref): Likewise. (initialize_data_dependence_relation): Call base_addr_differ_p. Compare dimensions for ARRAY_REFs only. (build_classic_dist_vector): Make static. (access_functions_are_affine_or_constant_p): Call macro to get the address of access functions. (compute_all_dependences): Add new parameter compute_self_and_read_read_dependences. Compute self and read-read dependences if it is true. (find_data_references_in_loop): Call create_data_ref. Initialize new data-ref fields. (compute_data_dependences_for_loop): Add new parameter compute_self_and_read_read_dependences. Remove parameter nb_loops, compute nb_loops. Call compute_all_dependences, build_classic_dist_vector and build_classic_dir_vector with correct parameters. (analyze_all_data_dependences): Call compute_data_dependences_for_loop with correct parameters. Compare dimensions for ARRAY_REFs only. (free_data_refs): Call macro to free access functions. * tree-data-ref.h (struct first_location_in_loop): New structure. Move fields from stmt_vinfo. (struct base_object_info): New structure. (struct data_reference): Move fields to base_object_info. Add fields first_location and object_info for above structures. Move fields from stmt_info: memtag, ptr_info, subvars, misalignment. Add new field aligned_to. Add macros to access the new fields. Update functions declarations. * tree-flow.h (is_aliased_with): Declare. * tree-loop-linear.c (linear_transform_loops): Call compute_data_dependences_for_loop with correct parameters. * tree-ssa-alias.c (is_aliased_with): New function. * tree-vect-analyze.c (vect_get_ptr_offset): Remove. (vect_analyze_offset_expr, vect_base_addr_differ_p): Likewise. (vect_analyze_data_ref_dependence): Get ddr. Remove call to vect_base_addr_differ_p, compute_subscript_distance and build_classic_dist_vector. Add printings. Check absolute value of distance. (vect_analyze_data_ref_dependences): Go through ddrs instead of data-refs. (vect_compute_data_ref_alignment): Get the fields of data-ref instead of stmt. Check aligned_to. Check if the base is aligned. Remove conversion to bytes. Add printing. (vect_compute_data_refs_alignment): Go through loads and stores in one loop. (vect_enhance_data_refs_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access): Likewise. (vect_analyze_pointer_ref_access): Remove. (vect_address_analysis, vect_object_analysis): Likewise. (vect_analyze_data_refs): Call compute_data_dependences_for_loop to find and analyze data-refs in the loop. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Get the fields of data-ref instead of stmt. Add init to the offset from the base. (vect_create_data_ref_ptr): Get the fields of data-ref instead of stmt. (vect_update_init_of_dr): Likewise. (vect_update_inits_of_drs): Go through loads and stores in one loop. * tree-vectorizer.c (new_stmt_vec_info): Remove initialization of removed fields. (new_loop_vec_info): Initialize new fields. (destroy_loop_vec_info): Free new fields. (vect_strip_conversion): Remove. * tree-vectorizer.h (enum verbosity_levels): Add new verbosity level. (struct _loop_vec_info): Unify data_ref_writes and data_ref_reads into datarefs. Add new field ddrs. Add macros for the new fields access. (struct _stmt_vec_info): Remove: base_address, initial_offset, step, base_aligned_p, misalignment, memtag, ptr_info and subvars. Remove their macros. * tree.h (highest_pow2_factor): Declare. From-SVN: r102356
2005-07-25 14:05:07 +02:00
#define LOOP_VINFO_LOC(L) (L)->loop_line_number
tree-vectorizer.c (new_loop_vec_info): Initialize new field. gcc/ChangeLog * tree-vectorizer.c (new_loop_vec_info): Initialize new field. (destroy_loop_vec_info): Add call to VEC_free. * tree-vectorizer.h (may_alias_ddrs): Define. (LOOP_VINFO_MAY_ALIAS_DDRS): Define. * tree-vect-analyze.c (vect_analyze_data_ref_dependence): Change reporting to dump. (vect_is_duplicate_ddr): New. (vect_mark_for_runtime_alias_test): New. (vect_analyze_data_ref_dependences) Add call to vect_mark_for_runtime_alias_test. (vect_enhance_data_refs_alignment): Define local variable vect_versioning_for_alias_required, don't perform peeling for alignment if versioning for alias is required. (vect_enhance_data_refs_alignment): Use PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS instead of PARAM_VECT_MAX_VERSION_CHECKS. * tree-vect-transform.c (vect_create_cond_for_alias_checks): New. (vect_transform_loop): Add call to vect_create_cond_for_alias_checks. (vect_vfa_segment_size): New. * params.def (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS): Rename. (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS): Define. * gcc/doc/invoke.texi (vect-max-version-for-alignment-checks): Document. (vect-max-version-for-alias-checks): Document. (vect-max-version-checks): Remove. gcc/testsuite/ChangeLog * gcc.dg/vect/vect-vfa-01.c: New. * gcc.dg/vect/vect-vfa-02.c: New. * gcc.dg/vect/vect-vfa-03.c: New. * gcc.dg/vect/vect-vfa-04.c: New. * gcc.dg/vect/vect-102a.c, gcc.dg/vect/vect-51.c, gcc.dg/vect/pr29145.c, gcc.dg/vect/vect-43.c, gcc.dg/vect/vect-61.c, gcc.dg/vect/vect-53.c, gcc.dg/vect/vect-45.c, gcc.dg/vect/vect-101.c, gcc.dg/vect/vect-37.c, gcc.dg/vect/vect-79.c, gcc.dg/vect/vect-102.c, gcc.dg/vect/vect-dv-2.c, gcc.dg/vect/vect-57.c, gcc.dg/vect/vect-49.c, gfortran.dg/vect/pr19049.f90: Rename to start with prefix no-vfa-. * gcc.dg/vect/vect.exp: Disable versioning for alias when test starts with no-vfa-. * gfortran.dg/vect/vect.exp: Likewise. From-SVN: r127559
2007-08-16 16:20:39 +02:00
#define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
#define NITERS_KNOWN_P(n) \
(host_integerp ((n),0) \
&& TREE_INT_CST_LOW ((n)) > 0)
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
#define LOOP_VINFO_NITERS_KNOWN_P(L) \
NITERS_KNOWN_P((L)->num_iters)
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
static inline loop_vec_info
loop_vec_info_for_loop (struct loop *loop)
{
return (loop_vec_info) loop->aux;
}
static inline bool
nested_in_vect_loop_p (struct loop *loop, tree stmt)
{
return (loop->inner
&& (loop->inner == (bb_for_stmt (stmt))->loop_father));
}
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/*-----------------------------------------------------------------*/
/* Info on vectorized defs. */
/*-----------------------------------------------------------------*/
enum stmt_vec_info_type {
undef_vec_info_type = 0,
load_vec_info_type,
store_vec_info_type,
op_vec_info_type,
call_vec_info_type,
assignment_vec_info_type,
tree.def (REDUC_MAX_EXPR, [...]): New tree-codes. * tree.def (REDUC_MAX_EXPR, REDUC_MIN_EXPR, REDUC_PLUS_EXPR): New tree-codes. * optabs.h (OTI_reduc_smax, OTI_reduc_umax, OTI_reduc_smin, OTI_reduc_umin, OTI_reduc_plus): New optabs for reduction. (reduc_smax_optab, reduc_umax_optab, reduc_smin_optab, reduc_umin_optab, reduc_plus_optab): New optabs for reduction. * expr.c (expand_expr_real_1): Handle new tree-codes. * tree-inline.c (estimate_num_insns_1): Handle new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio, op_symbol): Handle new tree-codes. * optabs.c (optab_for_tree_code): Handle new tree-codes. (init_optabs): Initialize new optabs. * genopinit.c (optabs): Define handlers for new optabs. * tree-vect-analyze.c (vect_analyze_operations): Fail vectorization in case of a phi that is marked as relevant. Call vectorizable_reduction. (vect_mark_relevant): Phis may be marked as relevant. (vect_mark_stmts_to_be_vectorized): The use corresponding to the reduction variable in a reduction stmt does not mark its defining phi as relevant. Update documentation accordingly. (vect_can_advance_ivs_p): Skip reduction phis. * tree-vect-transform.c (vect_get_vec_def_for_operand): Takes additional argument. Handle reduction. (vect_create_destination_var): Update call to vect_get_new_vect_var. Handle non-vector argument. (get_initial_def_for_reduction): New function. (vect_create_epilog_for_reduction): New function. (vectorizable_reduction): New function. (vect_get_new_vect_var): Handle new vect_var_kind. (vectorizable_assignment, vectorizable_operation, vectorizable_store, vectorizable_condition): Update call to vect_get_new_vect_var. (vect_transform_stmt): Call vectorizable_reduction. (vect_update_ivs_after_vectorizer): Skip reduction phis. (vect_transform_loop): Skip if stmt is both not relevant and not live. * tree-vectorizer.c (reduction_code_for_scalar_code): New function. (vect_is_simple_reduction): Was empty - added implementation. * tree-vectorizer.h (vect_scalar_var): New enum vect_var_kind value. (reduc_vec_info_type): New enum vect_def_type value. * config/rs6000/altivec.md (reduc_smax_v4si, reduc_smax_v4sf, reduc_umax_v4si, reduc_smin_v4si, reduc_umin_v4sf, reduc_smin_v4sf, reduc_plus_v4si, reduc_plus_v4sf): New define_expands. * tree-vect-analyze.c (vect_determine_vectorization_factor): Remove ENABLE_CHECKING around gcc_assert. * tree-vect-transform.c (vect_do_peeling_for_loop_bound, (vect_do_peeling_for_alignment, vect_transform_loop, vect_get_vec_def_for_operand): Likewise. From-SVN: r101155
2005-06-18 15:18:52 +02:00
condition_vec_info_type,
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
reduc_vec_info_type,
induc_vec_info_type,
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
type_promotion_vec_info_type,
type_demotion_vec_info_type,
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
type_conversion_vec_info_type,
loop_exit_ctrl_vec_info_type
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
};
/* Indicates whether/how a variable is used in the loop. */
enum vect_relevant {
vect_unused_in_loop = 0,
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
vect_used_in_outer_by_reduction,
vect_used_in_outer,
/* defs that feed computations that end up (only) in a reduction. These
defs may be used by non-reduction stmts, but eventually, any
computations/values that are affected by these defs are used to compute
a reduction (i.e. don't get stored to memory, for example). We use this
to identify computations that we can change the order in which they are
computed. */
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
vect_used_by_reduction,
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
vect_used_in_loop
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
};
typedef struct data_reference *dr_p;
DEF_VEC_P(dr_p);
DEF_VEC_ALLOC_P(dr_p,heap);
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
typedef struct _stmt_vec_info {
enum stmt_vec_info_type type;
/* The stmt to which this info struct refers to. */
tree stmt;
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
/* The loop_vec_info with respect to which STMT is vectorized. */
loop_vec_info loop_vinfo;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
/* Not all stmts in the loop need to be vectorized. e.g, the increment
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
of the loop induction variable and computation of array indexes. relevant
indicates whether the stmt needs to be vectorized. */
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
enum vect_relevant relevant;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
/* Indicates whether this stmts is part of a computation whose result is
used outside the loop. */
bool live;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/* The vector type to be used. */
tree vectype;
/* The vectorized version of the stmt. */
tree vectorized_stmt;
/** The following is relevant only for stmts that contain a non-scalar
data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
at most one such data-ref. **/
/* Information about the data-ref (access function, etc). */
struct data_reference *data_ref_info;
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
/* Stmt is part of some pattern (computation idiom) */
bool in_pattern_p;
/* Used for various bookkeeping purposes, generally holding a pointer to
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
some other stmt S that is in some way "related" to this stmt.
Current use of this field is:
If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is
true): S is the "pattern stmt" that represents (and replaces) the
sequence of stmts that constitutes the pattern. Similarly, the
related_stmt of the "pattern stmt" points back to this stmt (which is
the last stmt in the original sequence of stmts that constitutes the
pattern). */
tree related_stmt;
/* List of datarefs that are known to have the same alignment as the dataref
of this stmt. */
VEC(dr_p,heap) *same_align_refs;
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
/* Classify the def of this stmt. */
enum vect_def_type def_type;
c-tree.texi: Document new tree codes. * doc/c-tree.texi: Document new tree codes. * doc/md.texi: Document new optabs. * tree-pretty-print.c (dump_generic_node): Handle print of new tree codes. * optabs.c (optab_for_tree_code, init_optabs): Handle new optabs. * optabs.h (optab_index): Add new. (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): New optabs. * genopinit.c (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): Initialize new optabs. * expr.c (expand_expr_real_1): Add implementation for new tree codes. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (stmt_vec_info): Add new fields for interleaving along with macros for their access. * tree-data-ref.h (first_location_in_loop, data_reference): Update comment. * tree-vect-analyze.c (toplev.h): Include. (vect_determine_vectorization_factor): Fix indentation. (vect_insert_into_interleaving_chain, vect_update_interleaving_chain, vect_equal_offsets): New functions. (vect_analyze_data_ref_dependence): Add argument for interleaving check. Check for interleaving if it's true. (vect_check_dependences): New function. (vect_analyze_data_ref_dependences): Call vect_check_dependences for every ddr. Call vect_analyze_data_ref_dependence with new argument. (vect_update_misalignment_for_peel): Update for interleaving. (vect_verify_datarefs_alignment): Check only first data-ref for interleaving. (vect_enhance_data_refs_alignment): Update for interleaving. Check only first data-ref for interleaving. (vect_analyze_data_ref_access): Check interleaving, update interleaving data. (vect_analyze_data_refs): Call compute_data_dependences_for_loop with different parameters. * tree.def (VEC_EXTRACT_EVEN_EXPR, VEC_EXTRACT_ODD_EXPR, VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): New tree codes. * tree-inline.c (estimate_num_insns_1): Add cases for new codes. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Update step in case of interleaving. (vect_strided_store_supported, vect_permute_store_chain): New functions. (vectorizable_store): Handle strided stores. (vect_strided_load_supported, vect_permute_load_chain, vect_transform_strided_load): New functions. (vectorizable_load): Handle strided loads. (vect_transform_stmt): Add argument. Handle strided stores. Check that vectorized stmt exists for patterns. (vect_gen_niters_for_prolog_loop): Update calculation for interleaving. (vect_transform_loop): Remove stmt_vec_info for strided stores after whole chain vectorization. * config/rs6000/altivec.md (UNSPEC_EXTEVEN, UNSPEC_EXTODD, UNSPEC_INTERHI, UNSPEC_INTERLO): New constants. (vpkuhum_nomode, vpkuwum_nomode, vec_extract_even<mode>, vec_extract_odd<mode>, altivec_vmrghsf, altivec_vmrglsf, vec_interleave_high<mode>, vec_interleave_low<mode>): Implement. From-SVN: r119088
2006-11-22 09:46:03 +01:00
/* Interleaving info. */
/* First data-ref in the interleaving group. */
tree first_dr;
/* Pointer to the next data-ref in the group. */
tree next_dr;
/* The size of the interleaving group. */
unsigned int size;
/* For stores, number of stores from this group seen. We vectorize the last
one. */
unsigned int store_count;
/* For loads only, the gap from the previous load. For consecutive loads, GAP
is 1. */
unsigned int gap;
/* In case that two or more stmts share data-ref, this is the pointer to the
previously detected stmt with the same dr. */
tree same_dr_stmt;
/* For loads only, if there is a store with the same location, this field is
TRUE. */
bool read_write_dep;
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
/* Vectorization costs associated with statement. */
struct
{
int outside_of_loop; /* Statements generated outside loop. */
int inside_of_loop; /* Statements generated inside loop. */
} cost;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
} *stmt_vec_info;
/* Access Functions. */
c-tree.texi: Document new tree codes. * doc/c-tree.texi: Document new tree codes. * doc/md.texi: Document new optabs. * tree-pretty-print.c (dump_generic_node): Handle print of new tree codes. * optabs.c (optab_for_tree_code, init_optabs): Handle new optabs. * optabs.h (optab_index): Add new. (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): New optabs. * genopinit.c (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): Initialize new optabs. * expr.c (expand_expr_real_1): Add implementation for new tree codes. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (stmt_vec_info): Add new fields for interleaving along with macros for their access. * tree-data-ref.h (first_location_in_loop, data_reference): Update comment. * tree-vect-analyze.c (toplev.h): Include. (vect_determine_vectorization_factor): Fix indentation. (vect_insert_into_interleaving_chain, vect_update_interleaving_chain, vect_equal_offsets): New functions. (vect_analyze_data_ref_dependence): Add argument for interleaving check. Check for interleaving if it's true. (vect_check_dependences): New function. (vect_analyze_data_ref_dependences): Call vect_check_dependences for every ddr. Call vect_analyze_data_ref_dependence with new argument. (vect_update_misalignment_for_peel): Update for interleaving. (vect_verify_datarefs_alignment): Check only first data-ref for interleaving. (vect_enhance_data_refs_alignment): Update for interleaving. Check only first data-ref for interleaving. (vect_analyze_data_ref_access): Check interleaving, update interleaving data. (vect_analyze_data_refs): Call compute_data_dependences_for_loop with different parameters. * tree.def (VEC_EXTRACT_EVEN_EXPR, VEC_EXTRACT_ODD_EXPR, VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): New tree codes. * tree-inline.c (estimate_num_insns_1): Add cases for new codes. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Update step in case of interleaving. (vect_strided_store_supported, vect_permute_store_chain): New functions. (vectorizable_store): Handle strided stores. (vect_strided_load_supported, vect_permute_load_chain, vect_transform_strided_load): New functions. (vectorizable_load): Handle strided loads. (vect_transform_stmt): Add argument. Handle strided stores. Check that vectorized stmt exists for patterns. (vect_gen_niters_for_prolog_loop): Update calculation for interleaving. (vect_transform_loop): Remove stmt_vec_info for strided stores after whole chain vectorization. * config/rs6000/altivec.md (UNSPEC_EXTEVEN, UNSPEC_EXTODD, UNSPEC_INTERHI, UNSPEC_INTERLO): New constants. (vpkuhum_nomode, vpkuwum_nomode, vec_extract_even<mode>, vec_extract_odd<mode>, altivec_vmrghsf, altivec_vmrglsf, vec_interleave_high<mode>, vec_interleave_low<mode>): Implement. From-SVN: r119088
2006-11-22 09:46:03 +01:00
#define STMT_VINFO_TYPE(S) (S)->type
#define STMT_VINFO_STMT(S) (S)->stmt
#define STMT_VINFO_LOOP_VINFO(S) (S)->loop_vinfo
#define STMT_VINFO_RELEVANT(S) (S)->relevant
#define STMT_VINFO_LIVE_P(S) (S)->live
#define STMT_VINFO_VECTYPE(S) (S)->vectype
#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
#define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
#define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
#define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
#define STMT_VINFO_DEF_TYPE(S) (S)->def_type
#define STMT_VINFO_DR_GROUP_FIRST_DR(S) (S)->first_dr
#define STMT_VINFO_DR_GROUP_NEXT_DR(S) (S)->next_dr
#define STMT_VINFO_DR_GROUP_SIZE(S) (S)->size
#define STMT_VINFO_DR_GROUP_STORE_COUNT(S) (S)->store_count
#define STMT_VINFO_DR_GROUP_GAP(S) (S)->gap
#define STMT_VINFO_DR_GROUP_SAME_DR_STMT(S)(S)->same_dr_stmt
#define STMT_VINFO_DR_GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep
c-tree.texi: Document new tree codes. * doc/c-tree.texi: Document new tree codes. * doc/md.texi: Document new optabs. * tree-pretty-print.c (dump_generic_node): Handle print of new tree codes. * optabs.c (optab_for_tree_code, init_optabs): Handle new optabs. * optabs.h (optab_index): Add new. (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): New optabs. * genopinit.c (vec_extract_even_optab, vec_extract_odd_optab, vec_interleave_high_optab, vec_interleave_low_optab): Initialize new optabs. * expr.c (expand_expr_real_1): Add implementation for new tree codes. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (stmt_vec_info): Add new fields for interleaving along with macros for their access. * tree-data-ref.h (first_location_in_loop, data_reference): Update comment. * tree-vect-analyze.c (toplev.h): Include. (vect_determine_vectorization_factor): Fix indentation. (vect_insert_into_interleaving_chain, vect_update_interleaving_chain, vect_equal_offsets): New functions. (vect_analyze_data_ref_dependence): Add argument for interleaving check. Check for interleaving if it's true. (vect_check_dependences): New function. (vect_analyze_data_ref_dependences): Call vect_check_dependences for every ddr. Call vect_analyze_data_ref_dependence with new argument. (vect_update_misalignment_for_peel): Update for interleaving. (vect_verify_datarefs_alignment): Check only first data-ref for interleaving. (vect_enhance_data_refs_alignment): Update for interleaving. Check only first data-ref for interleaving. (vect_analyze_data_ref_access): Check interleaving, update interleaving data. (vect_analyze_data_refs): Call compute_data_dependences_for_loop with different parameters. * tree.def (VEC_EXTRACT_EVEN_EXPR, VEC_EXTRACT_ODD_EXPR, VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): New tree codes. * tree-inline.c (estimate_num_insns_1): Add cases for new codes. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Update step in case of interleaving. (vect_strided_store_supported, vect_permute_store_chain): New functions. (vectorizable_store): Handle strided stores. (vect_strided_load_supported, vect_permute_load_chain, vect_transform_strided_load): New functions. (vectorizable_load): Handle strided loads. (vect_transform_stmt): Add argument. Handle strided stores. Check that vectorized stmt exists for patterns. (vect_gen_niters_for_prolog_loop): Update calculation for interleaving. (vect_transform_loop): Remove stmt_vec_info for strided stores after whole chain vectorization. * config/rs6000/altivec.md (UNSPEC_EXTEVEN, UNSPEC_EXTODD, UNSPEC_INTERHI, UNSPEC_INTERLO): New constants. (vpkuhum_nomode, vpkuwum_nomode, vec_extract_even<mode>, vec_extract_odd<mode>, altivec_vmrghsf, altivec_vmrglsf, vec_interleave_high<mode>, vec_interleave_low<mode>): Implement. From-SVN: r119088
2006-11-22 09:46:03 +01:00
#define DR_GROUP_FIRST_DR(S) (S)->first_dr
#define DR_GROUP_NEXT_DR(S) (S)->next_dr
#define DR_GROUP_SIZE(S) (S)->size
#define DR_GROUP_STORE_COUNT(S) (S)->store_count
#define DR_GROUP_GAP(S) (S)->gap
#define DR_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
#define DR_GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_loop)
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
#define STMT_VINFO_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
#define STMT_VINFO_INSIDE_OF_LOOP_COST(S) (S)->cost.inside_of_loop
/* These are some defines for the initial implementation of the vectorizer's
cost model. These will later be target specific hooks. */
/* Cost of conditional branch. */
#ifndef TARG_COND_BRANCH_COST
#define TARG_COND_BRANCH_COST 3
#endif
target.h (builtin_vectorization_cost): Add new target builtin. 2007-07-12 Dorit Nuzman <dorit@il.ibm.com> * target.h (builtin_vectorization_cost): Add new target builtin. * target-def.h (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): New. * tree-vectorizer.h (TARG_SCALAR_STMT_COST): New. (TARG_SCALAR_LOAD_COST, TARG_SCALAR_STORE_COST): New. * tree-vect-analyze.c (vect_analyze_slp_instance): Initisliaze uninitialized variables. * tree-vect-transform.c (cost_for_stmt): New function. (vect_estimate_min_profitable_iters): Call cost_for_stmt instead of using cost 1 for all scalar stmts. Be less conservative when estimating the number of prologue/epulogue iterations. Call targetm.vectorize.builtin_vectorization_cost. Return min_profitable_iters-1. (vect_model_reduction_cost): Use TARG_SCALAR_TO_VEC_COST for initialization cost instead of TARG_VEC_STMT_COST. Use TARG_VEC_TO_SCALAR_COST instead of TARG_VEC_STMT_COST for reduction epilogue code. Fix epilogue cost computation. * config/spu/spu.c (spu_builtin_vectorization_cost): New. (TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST): Implement. * config/spu/spu.h (TARG_COND_BRANCH_COST, TARG_SCALAR_STMT_COST): (TARG_SCALAR_LOAD_COST, TARG_SCALAR_STORE_COST, TARG_VEC_STMT_COST): (TARG_VEC_TO_SCALAR_COST, TARG_SCALAR_TO_VEC, TARG_VEC_LOAD_COST): (TARG_VEC_UNALIGNED_LOAD_COST, TARG_VEC_STORE_COST): Define. 2007-07-12 Dorit Nuzman <dorit@il.ibm.com> * gcc.dg/vect/costmodel/ppc/costmodel-vect-reduc-1char.c: Loops now get vectorized. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: Loops now get vectorized. * gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp: New. * gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-33.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c: New. * gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c: New. * lib/target-supports.exp (check_effective_target_vect_int_mul): Add spu. From-SVN: r126584
2007-07-12 14:17:03 +02:00
/* Cost of any scalar operation, excluding load and store. */
#ifndef TARG_SCALAR_STMT_COST
#define TARG_SCALAR_STMT_COST 1
#endif
/* Cost of scalar load. */
#ifndef TARG_SCALAR_LOAD_COST
#define TARG_SCALAR_LOAD_COST 1
#endif
/* Cost of scalar store. */
#ifndef TARG_SCALAR_STORE_COST
#define TARG_SCALAR_STORE_COST 1
#endif
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
/* Cost of any vector operation, excluding load, store or vector to scalar
operation. */
#ifndef TARG_VEC_STMT_COST
#define TARG_VEC_STMT_COST 1
#endif
/* Cost of vector to scalar operation. */
#ifndef TARG_VEC_TO_SCALAR_COST
#define TARG_VEC_TO_SCALAR_COST 1
#endif
tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.c (new_loop_vec_info): Initialize LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vectorizer.h (_loop_vec_info): Added new filed min_profitable_iters. (LOOP_VINFO_COST_MODEL_MIN_ITERS): New access macro to above new field. (TARG_SCALAR_TO_VEC_COST): Define cost of scalar to vector operation. * tree-vect-analyze.c (vect_analyze_operations): Set LOOP_VINFO_COST_MODEL_MIN_ITERS. * tree-vect-transform.c (vect_estimate_min_profitable_iters): Use VEC_length to determine if there are any LOOP_VINFO_MAY_MISALIGN_STMTS. Fix calculation of peel_iters_prologue. Move consideration of epilogue and prologue cost to after they are computed. (vect_model_induction_cost): Use TARG_SCALAR_TO_VEC_COST instead of TARG_VEC_STMT_COST. (vect_model_simple_cost): Takes additional argument dt. Consider cost of creating vectors from scalars according to dt. (vect_model_store_cost): Likewise. (vectorizable_call): Use dt array instead of scalar dt. Call vect_model_simple_cost with additional argument dt. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_store): Use dt array instead of scalar dt. Call vect_model_store_cost with additional argument dt. (vect_do_peeling_for_loop_bound): Don't call vect_estimate_min_profitable_iters. Instead, lookup LOOP_VINFO_COST_MODEL_MIN_ITERS. Don't always print "may not be profitable". * gcc.dg/vect/costmodel/ppc: New directory. * gcc.dg/vect/costmodel/ppc/ppc-costmodel-vect.exp: New. * gcc.dg/vect/costmodel/ppc/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-31d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68a.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68b.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68c.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-68d.c: New test. * gcc.dg/vect/costmodel/ppc/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: Now vectorized. From-SVN: r126368
2007-07-05 15:15:20 +02:00
/* Cost of scalar to vector operation. */
#ifndef TARG_SCALAR_TO_VEC_COST
#define TARG_SCALAR_TO_VEC_COST 1
#endif
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
/* Cost of aligned vector load. */
#ifndef TARG_VEC_LOAD_COST
#define TARG_VEC_LOAD_COST 1
#endif
/* Cost of misaligned vector load. */
#ifndef TARG_VEC_UNALIGNED_LOAD_COST
#define TARG_VEC_UNALIGNED_LOAD_COST 2
#endif
/* Cost of vector store. */
#ifndef TARG_VEC_STORE_COST
#define TARG_VEC_STORE_COST 1
#endif
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
static inline void set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info);
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
static inline stmt_vec_info vinfo_for_stmt (tree stmt);
static inline void
set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info)
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
{
if (ann)
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
ann->common.aux = (char *) stmt_info;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
}
static inline stmt_vec_info
vinfo_for_stmt (tree stmt)
{
stmt_ann_t ann = stmt_ann (stmt);
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
return ann ? (stmt_vec_info) ann->common.aux : NULL;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
}
static inline bool
is_pattern_stmt_p (stmt_vec_info stmt_info)
{
tree related_stmt;
stmt_vec_info related_stmt_info;
related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
if (related_stmt
&& (related_stmt_info = vinfo_for_stmt (related_stmt))
&& STMT_VINFO_IN_PATTERN_P (related_stmt_info))
return true;
return false;
}
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
static inline bool
is_loop_header_bb_p (basic_block bb)
{
if (bb == (bb->loop_father)->header)
return true;
gcc_assert (EDGE_COUNT (bb->preds) == 1);
return false;
}
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. * tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. (known_alignment_for_access_p): New. (do_peeling_for_alignment): Field made int instead of bool and renamed to peeling_for_alignment. (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to LOOP_PEELING_FOR_ALIGNMENT. * tree-vect-analyze.c (vect_determine_vectorization_factor): New. This functionality used to be in vect_analyze_operations. (vect_analyze_operations): Code to determine vectorization factor was moved to vect_determine_vectorization_factor. (vect_enhance_data_refs_alignment): Update to correct alignment when it is known instead of -1. Set LOOP_PEELING_FOR_ALIGNMENT to peeling factor. (vect_analyze_loop): Call vect_determine_vectorization_factor (used to be part of vect_analyze_operations). * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Use fold when creating the guard condition, as the number of iterations may be constant. (slpeel_tree_peel_loop_to_edge): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. Set it to 0 instead of false. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Handle known alignment case more efficiently. Use LOOP_PEELING_FOR_ALIGNMENT. (vect_do_peeling_for_alignment): Use fold. (vect_transform_loop): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr. (vect_update_inits_of_drs): Use new name of vect_update_inits_of_dr. (vectorizable_store): Fix assertion to use == instead of =. From-SVN: r96526
2005-03-15 19:33:09 +01:00
/* Reflects actual alignment of first access in the vectorized loop,
taking into account peeling/versioning if applied. */
#define DR_MISALIGNMENT(DR) ((int) (size_t) (DR)->aux)
#define SET_DR_MISALIGNMENT(DR, VAL) ((DR)->aux = (void *) (size_t) (VAL))
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
static inline bool
aligned_access_p (struct data_reference *data_ref_info)
{
return (DR_MISALIGNMENT (data_ref_info) == 0);
}
static inline bool
tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. * tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. (known_alignment_for_access_p): New. (do_peeling_for_alignment): Field made int instead of bool and renamed to peeling_for_alignment. (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to LOOP_PEELING_FOR_ALIGNMENT. * tree-vect-analyze.c (vect_determine_vectorization_factor): New. This functionality used to be in vect_analyze_operations. (vect_analyze_operations): Code to determine vectorization factor was moved to vect_determine_vectorization_factor. (vect_enhance_data_refs_alignment): Update to correct alignment when it is known instead of -1. Set LOOP_PEELING_FOR_ALIGNMENT to peeling factor. (vect_analyze_loop): Call vect_determine_vectorization_factor (used to be part of vect_analyze_operations). * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Use fold when creating the guard condition, as the number of iterations may be constant. (slpeel_tree_peel_loop_to_edge): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. Set it to 0 instead of false. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Handle known alignment case more efficiently. Use LOOP_PEELING_FOR_ALIGNMENT. (vect_do_peeling_for_alignment): Use fold. (vect_transform_loop): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr. (vect_update_inits_of_drs): Use new name of vect_update_inits_of_dr. (vectorizable_store): Fix assertion to use == instead of =. From-SVN: r96526
2005-03-15 19:33:09 +01:00
known_alignment_for_access_p (struct data_reference *data_ref_info)
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
{
tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. * tree-vectorizer.h (unknown_alignment_for_access_p): Replaced by known_alignment_for_access_p. (known_alignment_for_access_p): New. (do_peeling_for_alignment): Field made int instead of bool and renamed to peeling_for_alignment. (LOOP_DO_PEELING_FOR_ALIGNMENT): Renamed to LOOP_PEELING_FOR_ALIGNMENT. * tree-vect-analyze.c (vect_determine_vectorization_factor): New. This functionality used to be in vect_analyze_operations. (vect_analyze_operations): Code to determine vectorization factor was moved to vect_determine_vectorization_factor. (vect_enhance_data_refs_alignment): Update to correct alignment when it is known instead of -1. Set LOOP_PEELING_FOR_ALIGNMENT to peeling factor. (vect_analyze_loop): Call vect_determine_vectorization_factor (used to be part of vect_analyze_operations). * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Use fold when creating the guard condition, as the number of iterations may be constant. (slpeel_tree_peel_loop_to_edge): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. Set it to 0 instead of false. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Handle known alignment case more efficiently. Use LOOP_PEELING_FOR_ALIGNMENT. (vect_do_peeling_for_alignment): Use fold. (vect_transform_loop): Use new name of LOOP_DO_PEELING_FOR_ALIGNMENT. (vect_update_inits_of_dr): Renamed to vect_update_init_of_dr. (vect_update_inits_of_drs): Use new name of vect_update_inits_of_dr. (vectorizable_store): Fix assertion to use == instead of =. From-SVN: r96526
2005-03-15 19:33:09 +01:00
return (DR_MISALIGNMENT (data_ref_info) != -1);
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
}
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/* vect_dump will be set to stderr or dump_file if exist. */
extern FILE *vect_dump;
extern enum verbosity_levels vect_verbosity_level;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/* Bitmap of virtual variables to be renamed. */
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
extern bitmap vect_memsyms_to_rename;
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
/*-----------------------------------------------------------------*/
/* Function prototypes. */
/*-----------------------------------------------------------------*/
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/*************************************************************************
Simple Loop Peeling Utilities - in tree-vectorizer.c
*************************************************************************/
/* Entry point for peeling of simple loops.
Peel the first/last iterations of a loop.
It can be used outside of the vectorizer for loops that are simple enough
(see function documentation). In the vectorizer it is used to peel the
last few iterations when the loop bound is unknown or does not evenly
divide by the vectorization factor, and to peel the first few iterations
to force the alignment of data references in the loop. */
extern struct loop *slpeel_tree_peel_loop_to_edge
(struct loop *, edge, tree, tree, bool, unsigned int);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
alias.c (component_uses_parent_alias_set): Constify. * alias.c (component_uses_parent_alias_set): Constify. * alias.h (component_uses_parent_alias_set): Likewise. * cfgrtl.c (print_rtl_with_bb): Likewise. * double-int.c (tree_to_double_int, double_int_fits_to_tree_p, mpz_get_double_int): Likewise. * double-int.h (double_int_fits_to_tree_p, tree_to_double_int, mpz_get_double_int): Likewise. * expr.c (is_aligning_offset, undefined_operand_subword_p, mostly_zeros_p, all_zeros_p, safe_from_p, is_aligning_offset): Likewise. * expr.h (safe_from_p): Likewise. * gimple-low.c (try_catch_may_fallthru, block_may_fallthru): Likewise. * gimplify.c (should_carry_locus_p, zero_sized_field_decl, zero_sized_type, goa_lhs_expr_p): Likewise. * omp-low.c (is_variable_sized, use_pointer_for_field): Likewise. * rtl.h (print_rtl_with_bb): Likewise. * sched-vis.c (print_exp, print_value, print_pattern): Likewise. * tree-cfg.c (const_first_stmt, const_last_stmt): New. * tree-flow-inline.h (bb_stmt_list): Constify. (cbsi_start, cbsi_last, cbsi_end_p, cbsi_next, cbsi_prev, cbsi_stmt): New. * tree-flow.h (const_block_stmt_iterator, cbsi_start, cbsi_last, const_first_stmt, const_last_stmt): New. (block_may_fallthru, empty_block_p): Constify. * tree-iterator.c (EXPR_FIRST_BODY, EXPR_LAST_BODY, EXPR_ONLY_BODY): New. (expr_first, expr_last, expr_only): Use macro for body. (const_expr_first, const_expr_last, const_expr_only): New. * tree-iterator.h (const_tree_stmt_iterator, ctsi_start, ctsi_last, ctsi_end_p, ctsi_one_before_end_p, ctsi_next, ctsi_prev, ctsi_stmt): New. * tree-scalar-evolution.c (get_loop_exit_condition): Constify. * tree-scalar-evolution.h (get_loop_exit_condition): Likewise. * tree-ssa-loop-niter.c (loop_only_exit_p, derive_constant_upper_bound): Likewise. * tree-ssa-phiopt.c (empty_block_p): Likewise. * tree-ssa-threadupdate.c (redirection_block_p): Likewise. * tree-vectorizer.c (slpeel_can_duplicate_loop_p): Likewise. * tree-vectorizer.h (slpeel_can_duplicate_loop_p): Likewise. * tree-vrp.c (vrp_bitmap_equal_p): Likewise. * tree.c (get_type_static_bounds): Likewise. * tree.h (const_expr_first, const_expr_last, const_expr_only): New. (get_type_static_bounds): Constify. From-SVN: r127483
2007-08-14 17:18:11 +02:00
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
#ifdef ENABLE_CHECKING
extern void slpeel_verify_cfg_after_peeling (struct loop *, struct loop *);
#endif
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/*************************************************************************
General Vectorization Utilities
*************************************************************************/
/** In tree-vectorizer.c **/
extern tree get_vectype_for_scalar_type (tree);
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
extern bool vect_is_simple_use (tree, loop_vec_info, tree *, tree *,
enum vect_def_type *);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
extern bool vect_is_simple_iv_evolution (unsigned, tree, tree *, tree *);
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
extern tree vect_is_simple_reduction (loop_vec_info, tree);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
extern bool vect_can_force_dr_alignment_p (tree, unsigned int);
extern enum dr_alignment_support vect_supportable_dr_alignment
(struct data_reference *);
tree.def (REDUC_MAX_EXPR, [...]): New tree-codes. * tree.def (REDUC_MAX_EXPR, REDUC_MIN_EXPR, REDUC_PLUS_EXPR): New tree-codes. * optabs.h (OTI_reduc_smax, OTI_reduc_umax, OTI_reduc_smin, OTI_reduc_umin, OTI_reduc_plus): New optabs for reduction. (reduc_smax_optab, reduc_umax_optab, reduc_smin_optab, reduc_umin_optab, reduc_plus_optab): New optabs for reduction. * expr.c (expand_expr_real_1): Handle new tree-codes. * tree-inline.c (estimate_num_insns_1): Handle new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio, op_symbol): Handle new tree-codes. * optabs.c (optab_for_tree_code): Handle new tree-codes. (init_optabs): Initialize new optabs. * genopinit.c (optabs): Define handlers for new optabs. * tree-vect-analyze.c (vect_analyze_operations): Fail vectorization in case of a phi that is marked as relevant. Call vectorizable_reduction. (vect_mark_relevant): Phis may be marked as relevant. (vect_mark_stmts_to_be_vectorized): The use corresponding to the reduction variable in a reduction stmt does not mark its defining phi as relevant. Update documentation accordingly. (vect_can_advance_ivs_p): Skip reduction phis. * tree-vect-transform.c (vect_get_vec_def_for_operand): Takes additional argument. Handle reduction. (vect_create_destination_var): Update call to vect_get_new_vect_var. Handle non-vector argument. (get_initial_def_for_reduction): New function. (vect_create_epilog_for_reduction): New function. (vectorizable_reduction): New function. (vect_get_new_vect_var): Handle new vect_var_kind. (vectorizable_assignment, vectorizable_operation, vectorizable_store, vectorizable_condition): Update call to vect_get_new_vect_var. (vect_transform_stmt): Call vectorizable_reduction. (vect_update_ivs_after_vectorizer): Skip reduction phis. (vect_transform_loop): Skip if stmt is both not relevant and not live. * tree-vectorizer.c (reduction_code_for_scalar_code): New function. (vect_is_simple_reduction): Was empty - added implementation. * tree-vectorizer.h (vect_scalar_var): New enum vect_var_kind value. (reduc_vec_info_type): New enum vect_def_type value. * config/rs6000/altivec.md (reduc_smax_v4si, reduc_smax_v4sf, reduc_umax_v4si, reduc_smin_v4si, reduc_umin_v4sf, reduc_smin_v4sf, reduc_plus_v4si, reduc_plus_v4sf): New define_expands. * tree-vect-analyze.c (vect_determine_vectorization_factor): Remove ENABLE_CHECKING around gcc_assert. * tree-vect-transform.c (vect_do_peeling_for_loop_bound, (vect_do_peeling_for_alignment, vect_transform_loop, vect_get_vec_def_for_operand): Likewise. From-SVN: r101155
2005-06-18 15:18:52 +02:00
extern bool reduction_code_for_scalar_code (enum tree_code, enum tree_code *);
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
extern bool supportable_widening_operation (enum tree_code, tree, tree,
tree *, tree *, enum tree_code *, enum tree_code *);
re PR tree-optimization/24659 (Conversions are not vectorized) PR tree-optimization/24659 * optabs.h (enum optab_index): Add OTI_vec_unpacks_float_hi, OTI_vec_unpacks_float_lo, OTI_vec_unpacku_float_hi, OTI_vec_unpacku_float_lo, OTI_vec_pack_sfix_trunc and OTI_vec_pack_ufix_trunc. (vec_unpacks_float_hi_optab): Define new macro. (vec_unpacks_float_lo_optab): Ditto. (vec_unpacku_float_hi_optab): Ditto. (vec_unpacku_float_lo_optab): Ditto. (vec_pack_sfix_trunc_optab): Ditto. (vec_pack_ufix_trunc_optab): Ditto. * genopinit.c (optabs): Implement vec_unpack[s|u]_[hi|lo]_optab and vec_pack_[s|u]fix_trunc_optab using vec_unpack[s|u]_[hi\lo]_* and vec_pack_[u|s]fix_trunc_* patterns * tree-vectorizer.c (supportable_widening_operation): Handle FLOAT_EXPR and CONVERT_EXPR. Update comment. (supportable_narrowing_operation): New function. * tree-vectorizer.h (supportable_narrowing_operation): Prototype. * tree-vect-transform.c (vectorizable_conversion): Handle (nunits_in == nunits_out / 2) and (nunits_out == nunits_in / 2) cases. (vect_gen_widened_results_half): Move before vectorizable_conversion. (vectorizable_type_demotion): Call supportable_narrowing_operation() to check for target support. * optabs.c (optab_for_tree_code) Return vec_unpack[s|u]_float_hi_optab for VEC_UNPACK_FLOAT_HI_EXPR, vec_unpack[s|u]_float_lo_optab for VEC_UNPACK_FLOAT_LO_EXPR and vec_pack_[u|s]fix_trunc_optab for VEC_PACK_FIX_TRUNC_EXPR. (expand_binop): Special case mode of the result for vec_pack_[u|s]fix_trunc_optab. (init_optabs): Initialize vec_unpack[s|u]_[hi|lo]_optab and vec_pack_[u|s]fix_trunc_optab. * tree.def (VEC_UNPACK_FLOAT_HI_EXPR, VEC_UNPACK_FLOAT_LO_EXPR, VEC_PACK_FIX_TRUNC_EXPR): New tree codes. * tree-pretty-print.c (dump_generic_node): Handle VEC_UNPACK_FLOAT_HI_EXPR, VEC_UNPACK_FLOAT_LO_EXPR and VEC_PACK_FIX_TRUNC_EXPR. (op_prio): Ditto. * expr.c (expand_expr_real_1): Ditto. * tree-inline.c (estimate_num_insns_1): Ditto. * tree-vect-generic.c (expand_vector_operations_1): Ditto. * config/i386/sse.md (vec_unpacks_float_hi_v8hi): New expander. (vec_unpacks_float_lo_v8hi): Ditto. (vec_unpacku_float_hi_v8hi): Ditto. (vec_unpacku_float_lo_v8hi): Ditto. (vec_unpacks_float_hi_v4si): Ditto. (vec_unpacks_float_lo_v4si): Ditto. (vec_pack_sfix_trunc_v2df): Ditto. * doc/c-tree.texi (Expression trees) [VEC_UNPACK_FLOAT_HI_EXPR]: Document. [VEC_UNPACK_FLOAT_LO_EXPR]: Ditto. [VEC_PACK_FIX_TRUNC_EXPR]: Ditto. * doc/md.texi (Standard Names) [vec_pack_sfix_trunc]: Document. [vec_pack_ufix_trunc]: Ditto. [vec_unpacks_float_hi]: Ditto. [vec_unpacks_float_lo]: Ditto. [vec_unpacku_float_hi]: Ditto. [vec_unpacku_float_lo]: Ditto. testsuite/ChangeLog: PR tree-optimization/24659 * gcc.dg/vect/vect-floatint-conversion-2.c: New test. * gcc.dg/vect/vect-intfloat-conversion-1.c: Require vect_float, not vect_int target. * gcc.dg/vect/vect-intfloat-conversion-2.c: Require vect_float, not vect_int target. Loop is vectorized for vect_intfloat_cvt targets. * gcc.dg/vect/vect-intfloat-conversion-3.c: New test. * gcc.dg/vect/vect-intfloat-conversion-4a.c: New test. * gcc.dg/vect/vect-intfloat-conversion-4b.c: New test. From-SVN: r124784
2007-05-17 08:31:05 +02:00
extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
enum tree_code *);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/* Creation and deletion of loop and stmt info structs. */
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
extern loop_vec_info new_loop_vec_info (struct loop *loop);
tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. * tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. (nested_in_vect_loop_p): New function. (vect_relevant): Add enum values vect_used_in_outer_by_reduction and vect_used_in_outer. (is_loop_header_bb_p): New. Used to differentiate loop-header phis from other phis in the loop. (destroy_loop_vec_info): Add additional argument to declaration. * tree-vectorizer.c (supportable_widening_operation): Also check if nested_in_vect_loop_p (don't allow changing the order in this case). (vect_is_simple_reduction): Takes a loop_vec_info as argument instead of struct loop. Call nested_in_vect_loop_p and don't require flag_unsafe_math_optimizations if it returns true. (new_stmt_vec_info): When setting def_type for phis differentiate loop-header phis from other phis. (bb_in_loop_p): New function. (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just update their loop_vinfo. Order of BB traversal now matters - call dfs_enumerate_from with bb_in_loop_p. (destroy_loop_vec_info): Takes additional argument to control whether stmt_vinfo of the loop stmts should be destroyed as well. (vect_is_simple_reduction): Allow the "non-reduction" use of a reduction stmt to be defines by a non loop-header phi. (vectorize_loops): Call destroy_loop_vec_info with additional argument. * tree-vect-transform.c (vectorizable_reduction): Call nested_in_vect_loop_p. Check for multitypes in the inner-loop. (vectorizable_call): Likewise. (vectorizable_conversion): Likewise. (vectorizable_operation): Likewise. (vectorizable_type_promotion): Likewise. (vectorizable_type_demotion): Likewise. (vectorizable_store): Likewise. (vectorizable_live_operation): Likewise. (vectorizable_reduction): Likewise. Also pass loop_info to vect_is_simple_reduction instead of loop. (vect_init_vector): Call nested_in_vect_loop_p. (get_initial_def_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vect_init_vector): Check which loop to work with, in case there's an inner-loop. (get_initial_def_for_inducion): Extend to handle outer-loop vectorization. Fix indentation. (vect_get_vec_def_for_operand): Support phis in the case vect_loop_def. In the case vect_induction_def get the vector def from the induction phi node, instead of calling get_initial_def_for_inducion. (get_initial_def_for_reduction): Extend to handle outer-loop vectorization. (vect_create_epilog_for_reduction): Extend to handle outer-loop vectorization. (vect_transform_loop): Change assert to just skip this case. Add a dump printout. (vect_finish_stmt_generation): Add a couple asserts. (vect_estimate_min_profitable_iters): Multiply cost of inner-loop stmts (in outer-loop vectorization) by estimated inner-loop bound. (vect_model_reduction_cost): Don't add reduction epilogue cost in case this is an inner-loop reduction in outer-loop vectorization. * tree-vect-analyze.c (vect_analyze_scalar_cycles_1): New function. Same code as what used to be vect_analyze_scalar_cycles, only with additional argument loop, and loop_info passed to vect_is_simple_reduction instead of loop. (vect_analyze_scalar_cycles): Code factored out into vect_analyze_scalar_cycles_1. Call it for each relevant loop-nest. Updated documentation. (analyze_operations): Check for inner-loop loop-closed exit-phis during outer-loop vectorization that are live or not used in the outerloop, cause this requires special handling. (vect_enhance_data_refs_alignment): Don't consider versioning for nested-loops. (vect_analyze_data_refs): Check that there are no datarefs in the inner-loop. (vect_mark_stmts_to_be_vectorized): Also consider vect_used_in_outer and vect_used_in_outer_by_reduction cases. (process_use): Also consider the case of outer-loop stmt defining an inner-loop stmt and vice versa. (vect_analyze_loop_1): New function. (vect_analyze_loop_form): Extend, to allow a restricted form of nested loops. Call vect_analyze_loop_1. (vect_analyze_loop): Skip (inner-)loops within outer-loops that have been vectorized. Call destroy_loop_vec_info with additional argument. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Don't allow in the inner-loop when doing outer-loop vectorization. Add documentation and printout. (vect_recog_dot_prod_pattern): Likewise. Also add check for GIMPLE_MODIFY_STMT (in case we encounter a phi in the loop). From-SVN: r127623
2007-08-19 11:39:50 +02:00
extern void destroy_loop_vec_info (loop_vec_info, bool);
tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function declaration added. (vect_analyze_data_ref_dependences): Likewise. (vect_is_simple_use): Argument changed from loop structure to loop_vect_info structure. (vect_can_advance_ivs_p): Likewise. (vect_create_index_for_vector_ref): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (new_stmt_vec_info): Likewise. (new_loop_vec_info): Second argument in call to new_stmt_vec_info was changed from loop to loop_vinfo. (vect_create_data_ref_ptr): First argument in call to vect_create_index_for_vector_ref was changed from loop to loop_vinfo. (vectorizable_assignment): Second argument in call to vect_is_simple_use was changed from loop to loop_vinfo. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vect_mark_stmts_to_be_vectorized): Likewise. (vect_do_peeling_for_loop_bound): First argument in call to vect_update_ivs_after_vectorizer was changed from loop to loop_vinfo. (vect_analyze_operations): Argument in call to vect_can_advance_ivs_p was changed from loop to loop_vinfo. (vect_analyze_data_ref_dependences): Third argument in call to vect_analyze_data_ref_dependence was changed from loop to loop_vinfo. (vect_create_index_for_vector_ref): Get the loop from loop_vinfo. (vect_create_data_ref_ptr): Likewise. (vect_init_vector): Likewise. (vect_get_vec_def_for_operand): Likewise. (vectorizable_assignment): Likewise. (vectorizable_operation): Likewise. (vectorizable_store): Likewise. (vectorizable_load): Likewise. (vect_update_ivs_after_vectorizer): Likewise. (vect_is_simple_use): Likewise. (vect_analyze_data_ref_dependence): Likewise. (vect_analyze_pointer_ref_access): Likewise. (vect_can_advance_ivs_p): Likewise. * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved before _stmt_vec_info. (_stmt_vec_info): Loop field replaced by loop_vec_info. (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO. (new_stmt_vec_info): Argument changed from loop structure to loop_vect_info structure (vect_analyze_data_ref_dependences): Unnecessary line was removed. (vect_analyze_offset_expr): Avoid 80 columns overflow. (vect_create_addr_base_for_vector_ref): Likewise. (vect_analyze_pointer_ref_access): Likewise. Co-Authored-By: Dorit Naishlos <dorit@il.ibm.com> From-SVN: r94661
2005-02-03 17:13:17 +01:00
extern stmt_vec_info new_stmt_vec_info (tree stmt, loop_vec_info);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/** In tree-vect-analyze.c **/
/* Driver for analysis stage. */
extern loop_vec_info vect_analyze_loop (struct loop *);
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
/** In tree-vect-patterns.c **/
/* Pattern recognition functions.
Additional pattern recognition functions can (and will) be added
in the future. */
typedef tree (* vect_recog_func_ptr) (tree, tree *, tree *);
#define NUM_PATTERNS 4
Makefile.in (tree-vect-patterns.o): Add rule for new file. * Makefile.in (tree-vect-patterns.o): Add rule for new file. * tree-vect-analyze.c (vect_determine_vectorization_factor): Use existing STMT_VINFO_VECTYPE if available. (vect_mark_relevant): Add special handling for stmts that are marked as STMT_VINFO_IN_PATTERN_P. (vect_analyze_loop): Call vect_pattern_recog. * tree-vectorizer.c (new_stmt_vec_info): Initialize new fields. * tree-vectorizer.h (in_pattern_p, related_stmt): New fields in stmt_info. (STMT_VINFO_IN_PATTERN_P, STMT_VINFO_RELATED_STMT): New macros. (vect_recog_func_ptr): New function-pointer type. * tree-vect-patterns.c: New file. (vect_recog_widen_sum_pattern, vect_recog_widen_mult_pattern): (vect_recog_dot_prod_pattern, vect_pattern_recog): (vect_pattern_recog_1): New functions. (vect_pattern_recog_funcs): New array of function pointers. * tree-vectorizer.h (ternary_op): New enum value. * tree-vect-transform.c (vect_create_epilog_for_reduction): Added declaration. Revised documentation. Removed redundant dump prints. Removed redundant argument. Added support for reduction patterns. (vectorizable_reduction): Added support for reduction patterns. (vect_transform_stmt): Added support for patterns. * expr.c (expand_expr_real_1): Added case for DOT_PROD_EXPR. * genopinit.c (udot_prod_optab, sdot_prod_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for DOT_PROD_EXPR. (expand_widen_pattern_expr): New function. (init_optabs): Initialize new optabs udot_prod_optab, sdot_prod_optab. * optabs.h (OTI_sdot_prod, OTI_udot_prod): New. (sdot_prod_optab, udot_prod_optab): Define new optabs. (expand_widen_pattern_expr): New function declaration. * tree.def (DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Added cases for new tree-codes DOT_PROD_EXPR, WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. (op_prio): Likewise. (op_symbol): Added cases for WIDEN_SUM_EXPR, WIDEN_MULT_EXPR. * tree-ssa-operands.c (get_expr_operands): Added case for DOT_PROD_EXPR. * tree-vect-patterns.c (widened_name_p): New function. (vect_recog_dot_prod_pattern): Added function implementation. * tree-vect-transform.c (get_initial_def_for_reduction): Added cases for DOT_PROD_EXPR, WIDEN_SUM_EXPR. * config/rs6000/altivec.md (udot_prod<mode>, sdot_prodv8hi): New. * config/i386/sse.md (sdot_prodv8hi, udot_prodv4si): New. * expr.c (expand_expr_real_1): Added case for WIDEN_SUM_EXPR. * genopinit.c (widen_ssum_optab, widen_usum_optab): Initialize. * optabs.c (optab_for_tree_code): Added case for WIDEN_SUM_EXPR. (init_optabs): Initialize new optabs widen_ssum_optab, widen_usum_optab. * optabs.h (OTI_widen_ssum, OTI_widen_usum): New. (widen_ssum_optab, widen_usum_optab): Define new optabs. * tree-vect-generic.c: (expand_vector_operations_1): Check type of use instead of type of def. * tree-vect-patterns.c (vect_recog_widen_sum_pattern): Added function implementation. * config/rs6000/altivec.md (widen_usum<mode>, widen_ssumv16qi, widen_ssumv8hi): New. * doc/tm.texi (ssum_widen, usum_widen, sdot_prod, udot_prod): New patterns. From-SVN: r109954
2006-01-19 11:24:00 +01:00
void vect_pattern_recog (loop_vec_info);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/** In tree-vect-transform.c **/
extern bool vectorizable_load (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_store (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_operation (tree, block_stmt_iterator *, tree *);
[multiple changes] 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Take enum argument instead of bool. (vect_analyze_operations): Call vectorizable_type_promotion. * tree-vectorizer.h (type_promotion_vec_info_type): New enum stmt_vec_info_type value. (supportable_widening_operation, vectorizable_type_promotion): New function declarations. * tree-vect-transform.c (vect_gen_widened_results_half): New function. (vectorizable_type_promotion): New function. (vect_transform_stmt): Call vectorizable_type_promotion. * tree-vect-analyze.c (supportable_widening_operation): New function. * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Add implementation. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR): (VEC_UNPACK_HI_EXPR, VEC_UNPACK_LO_EXPR): New tree-codes. * tree-inline.c (estimate_num_insns_1): Add cases for above new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. (init_optabs): Initialize new optabs. * genopinit.c (vec_widen_umult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_hi_optab, vec_widen_smult_lo_optab, vec_unpacks_hi_optab, vec_unpacks_lo_optab, vec_unpacku_hi_optab, vec_unpacku_lo_optab): Initialize new optabs. * optabs.h (OTI_vec_widen_umult_hi, OTI_vec_widen_umult_lo): (OTI_vec_widen_smult_h, OTI_vec_widen_smult_lo, OTI_vec_unpacks_hi, OTI_vec_unpacks_lo, OTI_vec_unpacku_hi, OTI_vec_unpacku_lo): New optab indices. (vec_widen_umult_hi_optab, vec_widen_umult_lo_optab): (vec_widen_smult_hi_optab, vec_widen_smult_lo_optab): (vec_unpacks_hi_optab, vec_unpacku_hi_optab, vec_unpacks_lo_optab): (vec_unpacku_lo_optab): New optabs. * doc/md.texi (vec_unpacks_hi, vec_unpacks_lo, vec_unpacku_hi): (vec_unpacku_lo, vec_widen_umult_hi, vec_widen_umult_lo): (vec_widen_smult_hi, vec_widen_smult_lo): New. * doc/c-tree.texi (VEC_LSHIFT_EXPR, VEC_RSHIFT_EXPR): (VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR, VEC_UNPACK_HI_EXPR): (VEC_UNPACK_LO_EXPR, VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New. * config/rs6000/altivec.md (UNSPEC_VMULWHUB, UNSPEC_VMULWLUB): (UNSPEC_VMULWHSB, UNSPEC_VMULWLSB, UNSPEC_VMULWHUH, UNSPEC_VMULWLUH): (UNSPEC_VMULWHSH, UNSPEC_VMULWLSH): New. (UNSPEC_VPERMSI, UNSPEC_VPERMHI): New. (vec_vperm_v8hiv4si, vec_vperm_v16qiv8hi): New patterns used to implement the unsigned unpacking patterns. (vec_unpacks_hi_v16qi, vec_unpacks_hi_v8hi, vec_unpacks_lo_v16qi): (vec_unpacks_lo_v8hi): New signed unpacking patterns. (vec_unpacku_hi_v16qi, vec_unpacku_hi_v8hi, vec_unpacku_lo_v16qi): (vec_unpacku_lo_v8hi): New unsigned unpacking patterns. (vec_widen_umult_hi_v16qi, vec_widen_umult_lo_v16qi): (vec_widen_smult_hi_v16qi, vec_widen_smult_lo_v16qi): (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): (vec_widen_smult_hi_v8hi, vec_widen_smult_lo_v8hi): New widening multiplication patterns. * target.h (builtin_mul_widen_even, builtin_mul_widen_odd): New. * target-def.h (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. * config/rs6000/rs6000.c (rs6000_builtin_mul_widen_even): New. (rs6000_builtin_mul_widen_odd): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): Defined. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): Defined. * tree-vectorizer.h (enum vect_relevant): New enum type. (_stmt_vec_info): Field relevant chaned from bool to enum vect_relevant. (STMT_VINFO_RELEVANT_P): Updated. (STMT_VINFO_RELEVANT): New. * tree-vectorizer.c (new_stmt_vec_info): Use STMT_VINFO_RELEVANT instead of STMT_VINFO_RELEVANT_P. * tree-vect-analyze.c (vect_mark_relevant, vect_stmt_relevant_p): Replace calls to STMT_VINFO_RELEVANT_P with STMT_VINFO_RELEVANT, and boolean variable with enum vect_relevant. (vect_mark_stmts_to_be_vectorized): Likewise + update documentation. * doc/tm.texi (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN): New. (TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD): New. 2006-11-08 Richard Henderson <rth@redhat.com> * config/i386/sse.md (vec_widen_umult_hi_v8hi, vec_widen_umult_lo_v8hi): New. (vec_widen_smult_hi_v4si, vec_widen_smult_lo_v4si, vec_widen_umult_hi_v4si, vec_widen_umult_lo_v4si): New. * config/i386/i386.c (ix86_expand_sse_unpack): New. * config/i386/i386-protos.h (ix86_expand_sse_unpack): New. * config/i386/sse.md (vec_unpacku_hi_v16qi, vec_unpacks_hi_v16qi, vec_unpacku_lo_v16qi, vec_unpacks_lo_v16qi, vec_unpacku_hi_v8hi, vec_unpacks_hi_v8hi, vec_unpacku_lo_v8hi, vec_unpacks_lo_v8hi, vec_unpacku_hi_v4si, vec_unpacks_hi_v4si, vec_unpacku_lo_v4si, vec_unpacks_lo_v4si): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_type_demotion): New function. (vect_transform_stmt): Add case for type_demotion_vec_info_type. (vect_analyze_operations): Call vectorizable_type_demotion. * tree-vectorizer.h (type_demotion_vec_info_type): New enum stmt_vec_info_type value. (vectorizable_type_demotion): New function declaration. * tree-vect-generic.c (expand_vector_operations_1): Consider correct mode. * tree.def (VEC_PACK_MOD_EXPR, VEC_PACK_SAT_EXPR): New tree-codes. * expr.c (expand_expr_real_1): Add case for VEC_PACK_MOD_EXPR and VEC_PACK_SAT_EXPR. * tree-iniline.c (estimate_num_insns_1): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.c (expand_binop): In case of vec_pack_*_optabs the mode compared against the predicate of the result is not 'mode' (the input to the function) but a mode with half the size of 'mode'. (init_optab): Initialize new optabs. * optabs.h (OTI_vec_pack_mod, OTI_vec_pack_ssat, OTI_vec_pack_usat): New optab indices. (vec_pack_mod_optab, vec_pack_ssat_optab, vec_pack_usat_optab): New optabs. * genopinit.c (vec_pack_mod_optab, vec_pack_ssat_optab): (vec_pack_usat_optab): Initialize new optabs. * doc/md.texi (vec_pack_mod, vec_pack_ssat, vec_pack_usat): New. * config/rs6000/altivec.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): New. 2006-11-08 Richard Henderson <rth@redehat.com> * config/i386/sse.md (vec_pack_mod_v8hi, vec_pack_mod_v4si): (vec_pack_mod_v2di, vec_interleave_highv16qi, vec_interleave_lowv16qi): (vec_interleave_highv8hi, vec_interleave_lowv8hi): (vec_interleave_highv4si, vec_interleave_lowv4si): (vec_interleave_highv2di, vec_interleave_lowv2di): New. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_reduction): Support multiple datatypes. (vect_transform_stmt): Removed redundant code. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_operation): Support multiple datatypes. 2006-11-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vect_align_data_ref): Removed. (vect_create_data_ref_ptr): Added additional argument - ptr_incr. Updated function documentation. Return the increment stmt in ptr_incr. (bump_vector_ptr): New function. (vect_get_vec_def_for_stmt_copy): New function. (vect_finish_stmt_generation): Create a stmt_info to newly created vector stmts. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_reduction, vectorizable_assignment): Not supported yet if VF is greater than the number of elements that can fit in one vector word. (vectorizable_operation, vectorizable_condition): Likewise. (vectorizable_store, vectorizable_load): Support the case that the VF is greater than the number of elements that can fit in one vector word. (vect_transform_loop): Don't fail in case of multiple data-types. * tree-vect-analyze.c (vect_determine_vectorization_factor): Don't fail in case of multiple data-types; the smallest type determines the VF. (vect_analyze_data_ref_dependence): Don't record datarefs as same_align if they are of different sizes. (vect_update_misalignment_for_peel): Compare misalignments in terms of number of elements rather than number of bytes. (vect_enhance_data_refs_alignment): Fix/Add dump printouts. (vect_can_advance_ivs_p): Fix a dump printout From-SVN: r118577
2006-11-08 08:32:44 +01:00
extern bool vectorizable_type_promotion (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_type_demotion (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_conversion (tree, block_stmt_iterator *,
tree *);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
extern bool vectorizable_assignment (tree, block_stmt_iterator *, tree *);
extern tree vectorizable_function (tree, tree, tree);
extern bool vectorizable_call (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_condition (tree, block_stmt_iterator *, tree *);
tree-flow.h (stmt_ann_d): Move aux to ... * tree-flow.h (stmt_ann_d): Move aux to ... (tree_ann_common_d): ... here. * tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt, move_computations_stmt, schedule_sm): Update references to aux. * tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Likewise. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_transform_loop): Likewise. * tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Likewise. * tree-vect-analyze.c (vect_analyze_scalar_cycles): Made void instead of bool. (vect_mark_relevant): Takes two additional arguments - live_p and relevant_p. Set RELEVANT_P and LIVE_P according to these arguments. (vect_stmt_relevant_p): Differentiate between a live stmt and a relevant stmt. Return two values = live_p and relevant_p. (vect_mark_stmts_to_be_vectorized): Call vect_mark_relevant and vect_stmt_relevant_p with additional arguments. Phis are no longer put into the worklist (analyzed seperately in analyze_scalar_cycles). (vect_determine_vectorization_factor): Also check for LIVE_P, because a stmt that is marked as irrelevant and live, cause it's only used out side the loop, may need to be vectorized (e.g. reduction). (vect_analyze_operations): Examine phis. Call vectorizable_live_operation for for LIVE_P stmts. Check if need_to_vectorize. (vect_analyze_scalar_cycles): Update documentation. Don't fail vectorization - just classify the scalar cycles created by the loop phis. Call vect_is_simple_reduction. (vect_analyze_loop): Call to analyze_scalar_cycles moved earlier. * tree-vect-transform.c (vect_create_index_for_vector_ref): Update call to set_stmt_info. (vect_get_vec_def_for_operand): Code reorganized - the code that classifies the type of use was factored out to vect_is_simple_use. (vectorizable_store, vect_is_simple_cond): Call vect_is_simple_use with additional arguments. (vectorizable_assignment): Likewise. Also make sure the stmt is relevant and computes a loop_vec_def. (vectorizable_operation, vectorizable_load, vectorizable_condition): Likewise. (vectorizable_live_operation): New. (vect_transform_stmt): Handle LIVE_P stmts. * tree-vectorizer.c (new_stmt_vec_info): Initialize the new fields STMT_VINFO_LIVE_P and STMT_VINFO_DEF_TYPE. (new_loop_vec_info, destroy_loop_vec_info): Also handle phis. (vect_is_simple_use): Determine the type of the def and return it in a new function argument. Consider vect_reduction_def and vect_induction_def, but for now these are not supported. (vect_is_simple_reduction): New. Empty for now. * tree-vectorizer.h (vect_def_type): New enum type. (_stmt_vec_info): Added new fields - live and _stmt_vec_info. (STMT_VINFO_LIVE_P, STMT_VINFO_DEF_TYPE): New accessor macros. (vect_is_simple_use): New arguments added to function declaration. (vect_is_simple_reduction): New function declaration. (vectorizable_live_operation): New function declaration. * tree-vect-analyze.c (vect_can_advance_ivs_p): Add debug printout. (vect_can_advance_ivs_p): Likewise. * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Likewise. From-SVN: r100617
2005-06-05 11:54:20 +02:00
extern bool vectorizable_live_operation (tree, block_stmt_iterator *, tree *);
tree.def (REDUC_MAX_EXPR, [...]): New tree-codes. * tree.def (REDUC_MAX_EXPR, REDUC_MIN_EXPR, REDUC_PLUS_EXPR): New tree-codes. * optabs.h (OTI_reduc_smax, OTI_reduc_umax, OTI_reduc_smin, OTI_reduc_umin, OTI_reduc_plus): New optabs for reduction. (reduc_smax_optab, reduc_umax_optab, reduc_smin_optab, reduc_umin_optab, reduc_plus_optab): New optabs for reduction. * expr.c (expand_expr_real_1): Handle new tree-codes. * tree-inline.c (estimate_num_insns_1): Handle new tree-codes. * tree-pretty-print.c (dump_generic_node, op_prio, op_symbol): Handle new tree-codes. * optabs.c (optab_for_tree_code): Handle new tree-codes. (init_optabs): Initialize new optabs. * genopinit.c (optabs): Define handlers for new optabs. * tree-vect-analyze.c (vect_analyze_operations): Fail vectorization in case of a phi that is marked as relevant. Call vectorizable_reduction. (vect_mark_relevant): Phis may be marked as relevant. (vect_mark_stmts_to_be_vectorized): The use corresponding to the reduction variable in a reduction stmt does not mark its defining phi as relevant. Update documentation accordingly. (vect_can_advance_ivs_p): Skip reduction phis. * tree-vect-transform.c (vect_get_vec_def_for_operand): Takes additional argument. Handle reduction. (vect_create_destination_var): Update call to vect_get_new_vect_var. Handle non-vector argument. (get_initial_def_for_reduction): New function. (vect_create_epilog_for_reduction): New function. (vectorizable_reduction): New function. (vect_get_new_vect_var): Handle new vect_var_kind. (vectorizable_assignment, vectorizable_operation, vectorizable_store, vectorizable_condition): Update call to vect_get_new_vect_var. (vect_transform_stmt): Call vectorizable_reduction. (vect_update_ivs_after_vectorizer): Skip reduction phis. (vect_transform_loop): Skip if stmt is both not relevant and not live. * tree-vectorizer.c (reduction_code_for_scalar_code): New function. (vect_is_simple_reduction): Was empty - added implementation. * tree-vectorizer.h (vect_scalar_var): New enum vect_var_kind value. (reduc_vec_info_type): New enum vect_def_type value. * config/rs6000/altivec.md (reduc_smax_v4si, reduc_smax_v4sf, reduc_umax_v4si, reduc_smin_v4si, reduc_umin_v4sf, reduc_smin_v4sf, reduc_plus_v4si, reduc_plus_v4sf): New define_expands. * tree-vect-analyze.c (vect_determine_vectorization_factor): Remove ENABLE_CHECKING around gcc_assert. * tree-vect-transform.c (vect_do_peeling_for_loop_bound, (vect_do_peeling_for_alignment, vect_transform_loop, vect_get_vec_def_for_operand): Likewise. From-SVN: r101155
2005-06-18 15:18:52 +02:00
extern bool vectorizable_reduction (tree, block_stmt_iterator *, tree *);
extern bool vectorizable_induction (tree, block_stmt_iterator *, tree *);
extend.texi: Add fvect-cost-model flag. gcc/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> Tony Linthicum <tony.linthicum@amd.com> * doc/extend.texi: Add fvect-cost-model flag. * common.opt (fvect-cost-model): New flag. * tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside cost fields in stmt_vec_info struct for STMT. * tree-vectorizer.h (stmt_vec_info): Define inside and outside cost fields in stmt_vec_info struct and access functions for the same. (TARG_COND_BRANCH_COST): Define cost of conditional branch. (TARG_VEC_STMT_COST): Define cost of any vector operation, excluding load, store and vector to scalar operation. (TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation. (TARG_VEC_LOAD_COST): Define cost of aligned vector load. (TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load. (TARG_VEC_STORE_COST): Define cost of vector store. (vect_estimate_min_profitable_iters): Define new function. * tree-vect-analyze.c (vect_analyze_operations): Add a compile-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. * tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a run-time check to evaluate if loop iterations are less than minimum profitable iterations determined by cost model or minimum vect loop bound defined by user, whichever is more conservative. (vect_estimate_min_profitable_iterations): New function to estimate mimimimum iterartions required for vector version of loop to be profitable over scalar version. (vect_model_reduction_cost): New function. (vect_model_induction_cost): New function. (vect_model_simple_cost): New function. (vect_cost_strided_group_size): New function. (vect_model_store_cost): New function. (vect_model_load_cost): New function. (vectorizable_reduction): Call vect_model_reduction_cost during analysis phase. (vectorizable_induction): Call vect_model_induction_cost during analysis phase. (vectorizable_load): Call vect_model_load_cost during analysis phase. (vectorizable_store): Call vect_model_store_cost during analysis phase. (vectorizable_call, vectorizable_assignment, vectorizable_operation, vectorizable_promotion, vectorizable_demotion): Call vect_model_simple_cost during analysis phase. gcc/testsuite/ChangeLog: 2007-06-08 Harsha Jagasia <harsha.jagasia@amd.com> * gcc.dg/vect/costmodel: New directory. * gcc.dg/vect/costmodel/i386: New directory. * gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64: New directory. * gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp: New testsuite. * gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test. * gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test. Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com> From-SVN: r125575
2007-06-08 18:30:49 +02:00
extern int vect_estimate_min_profitable_iters (loop_vec_info);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/* Driver for transformation stage. */
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments. * tree-vrp.c (execute_vrp): Do not pass loops structure through arguments. * loop-unswitch.c (unswitch_loops, unswitch_single_loop, unswitch_loop): Ditto. * tree-loop-linear.c (linear_transform_loops): Ditto. * tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize, tree_ssa_lim): Ditto. * tree-ssa-loop-niter.c (estimate_numbers_of_iterations, free_numbers_of_iterations_estimates): Ditto. * tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops, tree_unswitch_single_loop, tree_unswitch_loop): Ditto. * cfgloopmanip.c (fix_bb_placement, fix_bb_placements, remove_path, add_loop, loopify, unloop, fix_loop_placements, place_new_loop, duplicate_loop, duplicate_subloops, update_single_exit_for_duplicated_loops, copy_loops_to, duplicate_loop_to_header_edge, create_preheaders, force_single_succ_latches, loop_version, fix_loop_structure): Ditto. * tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge, tree_unroll_loop): Ditto. * tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * tree-scalar-evolution.c (select_loops_exit_conditions, scev_initialize, scev_analysis): Ditto. * tree-scalar-evolution.h (scev_initialize): Ditto. * cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto. * cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto. * modulo-sched.c (sms_schedule): Ditto. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * loop-init.c (loop_optimizer_init, rtl_move_loop_invariants, rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto. * ifcvt.c (if_convert): Ditto. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely, canonicalize_loop_induction_variables, canonicalize_induction_variables, tree_unroll_loops_completely, remove_empty_loops): Ditto. * tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im, tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform, tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds, tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts, tree_ssa_loop_done): Ditto. * predict.c (predict_loops, tree_estimate_probability, estimate_loops, estimate_bb_frequencies): Ditto. * tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto. * loop-unroll.c (unroll_and_peel_loops, peel_loops_completely, decide_unrolling_and_peeling, peel_loop_completely, unroll_loop_constant_iterations, unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid): Ditto. * loop-doloop.c (doloop_optimize_loops): Ditto. * tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto. * loop-invariant.c (move_loop_invariants): Ditto. * tree-ssa-dce.c (tree_ssa_dce_loop): Ditto. * tree-ssa-loop-prefetch.c (loop_prefetch_arrays, tree_ssa_prefetch_arrays): Ditto. * lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify): Ditto. * tree-vect-transform.c (vect_do_peeling_for_loop_bound, vect_do_peeling_for_alignment, vect_transform_loop): Ditto. * cfgloop.c (flow_loops_cfg_dump, flow_loops_dump, mark_single_exit_loops, cancel_loop, cancel_loop_tree, verify_loop_structure): Ditto. * tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops, canonicalize_induction_variables, tree_unroll_loops_completely, tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize, estimate_numbers_of_iterations, free_numbers_of_iterations_estimates, tree_duplicate_loop_to_header_edge, tree_ssa_loop_version, tree_unroll_loop, linear_transform_loops): Declaration changed. * basic-block.h: Remove declaration of struct loops. * cfghooks.h (struct cfg_hooks): Change type of cfg_hook_duplicate_loop_to_header_edge. (cfg_hook_duplicate_loop_to_header_edge): Declaration changed. * tree-vectorizer.h (slpeel_tree_peel_loop_to_edge, vect_transform_loop): Declaration changed. * lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed. * cfgloop.h (flow_loops_dump, fix_loop_structure, mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges, cancel_loop_tree, create_preheaders, force_single_succ_latches, verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge, loopify, loop_version, remove_path, unswitch_loops, unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants): Declaration changed. From-SVN: r119189
2006-11-25 11:34:13 +01:00
extern void vect_transform_loop (loop_vec_info);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
/*************************************************************************
Vectorization Debug Information - in tree-vectorizer.c
*************************************************************************/
tree-vectorizer.h (struct _loop_vec_info): Remove loop_line_number. * tree-vectorizer.h (struct _loop_vec_info): Remove loop_line_number. (LOOP_VINFO_LOC, LOOP_LOC): Remove. * tree-vectorizer.c (vect_loop_location): New. (vect_print_dump_info): Use vect_loop_location. (new_loop_vec_info): Do not set LOOP_VINFO_LOC. (vectorize_loops): Set vect_loop_location. * tree-vect-analyze.c (vect_analyze_offset_expr, vect_determin_vectorization_factor, vect_analyze_operations, vect_analyze_scalar_cycles, vect_analyze_data_ref_dependence, vect_analyze_data_ref_dependences, vect_compute_data_ref_alignment, vect_analyze_data_refs_alignment, vect_analyze_data_ref_access, vect_analyze_data_ref_accesses, vect_analyze_pointer_ref_access, vect_object_analysis, vect_analyze_data_refs, vect_mark_relevant, vect_stmt_relevant_p, vect_mark_stmts_to_be_vectorized, vect_can_advance_ivs_p, vect_get_loop_niters, vect_analyze_loop_form, vect_analyze_loop): Adjust vect_print_dump_info API. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref, vect_create_data_ref_ptr, vect_init_vector, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vectorizable_assignment, vectorizable_operation, vectorizable_store, vectorizable_load, vectorizable_live_operation, vectorizable_condition, vect_transform_stmt, vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound, vect_gen_ninters_for_prolog_loop, vect_do_peeling_for_alignment, vect_transform_loop): Same. * tree-vectorizer.c (get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_reduction, vect_is_simple_iv_evolution, vectorize_loops): Same. From-SVN: r101649
2005-07-06 04:25:08 +02:00
extern bool vect_print_dump_info (enum verbosity_levels);
Makefile.in (tree-vect-analyze.o, [...]): New. * Makefile.in (tree-vect-analyze.o, tree-vect-transform.o): New. (tree-vectorizer.o): Added missing dependencies. * tree-vectorizer.h (vect_dump, vect_verbosity_level): Added extern decleration. (slpeel_tree_peel_loop_to_edge): Function externalized (had a static declaration in tree-vectorizer.c, now has an extern declaration in tree-vectorizer.h). (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_analyze_loop, vectorizable_load, vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. * tree-vectorizer.c (langhooks.h): #include removed. (slpeel_tree_peel_loop_to_edge): Function externalized. Declaration moved to tree-vectorized.h. (slpeel_make_loop_iterate_ntimes, slpeel_can_duplicate_loop_p, slpeel_verify_cfg_after_peeling, vect_strip_conversion, get_vectype_for_scalar_type, vect_is_simple_use, vect_is_simple_iv_evolution, vect_can_force_dr_alignment_p, vect_supportable_dr_alignment, new_loop_vec_info, destroy_loop_vec_info, new_stmt_vec_info, vect_print_dump_info, vect_set_verbosity_level, find_loop_location): Likewise. (vect_analyze_loop): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-analyze.c. (vect_analyze_loop_form): Moved to tree-vect-analyze.c. (vect_mark_stmts_to_be_vectorized, vect_analyze_scalar_cycles, vect_analyze_data_ref_accesses, vect_analyze_data_ref_dependences, vect_analyze_data_refs_alignment, vect_compute_data_refs_alignment, vect_enhance_data_refs_alignment, vect_analyze_operations, exist_non_indexing_operands_for_use_p, vect_mark_relevant, vect_stmt_relevant_p, vect_get_loop_niters, vect_analyze_data_ref_dependence, vect_compute_data_ref_alignment, vect_analyze_data_ref_access, vect_analyze_pointer_ref_access, vect_can_advance_ivs_p, vect_get_ptr_offset, vect_analyze_offset_expr, vect_base_addr_differ_p, vect_object_analysis, vect_address_analysis, vect_get_memtag): Likewise. (vectorizable_load): Function externalized. Declaration moved to tree-vectorized.h. Function definition moved to tree-vect-transform.c. (vectorizable_store, vectorizable_operation, vectorizable_assignment, vect_transform_loop): Likewise. (vect_transform_stmt): Moved to tree-vect-transform.c. (vect_align_data_ref, vect_create_destination_var, vect_create_data_ref_ptr, vect_create_index_for_vector_ref, vect_create_addr_base_for_vector_ref, vect_get_new_vect_var, vect_get_vec_def_for_operand, vect_init_vector, vect_finish_stmt_generation, vect_generate_tmps_on_preheader, vect_build_loop_niters, vect_update_ivs_after_vectorizer, vect_gen_niters_for_prolog_loop, vect_update_inits_of_dr, vect_update_inits_of_drs, vect_do_peeling_for_alignment, vect_do_peeling_for_loop_bound): Likewise. * tree-vect-analyze.c: New file. * tree-vect-transform.c: New file. From-SVN: r95153
2005-02-17 09:47:28 +01:00
extern void vect_set_verbosity_level (const char *);
extern LOC find_loop_location (struct loop *);
tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees. * tree-vectorizer.h: New File: Same. * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files. * common.opt (ftree-vectorize): New flag to enable vectorization. * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization pass. * tree-data-ref.h (init_data_ref): Additional argument. (array_base_name_differ_p): Moved to tree-data-ref.c. * tree-data-ref.c (array_base_name_differ_p): Revised. (initialize_data_dependence_relation): Call array_base_name_differ_p with an extra argument. (analyze_all_data_dependences): Same. (init_data_ref): Additional argument is_read to set DR_IS_READ. * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file. * tree-flow.h (vectorize_loops, empty_block_p): Add declaration. * tree-optimize.c (pass_vectorize): Schedule the vectorization pass. * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new vectorization pass. * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize. (tree_ssa_loop_done): Call scev_finalize. (tree_vectorize): Define the new vectorization pass. * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of the vector they support (until support for multiple vector sizes is added to the vectorizer). * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define. * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define. * invoke.texi (fdump-tree-vect, ftree-vectorize): Add documentation. From-SVN: r86131
2004-08-17 18:17:14 +02:00
#endif /* GCC_TREE_VECTORIZER_H */