This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch adds the unaligned loads support functionality from lno to mainline. Bootstrapped and passed regression testing on ppc-darwin and i686-pc-linux-gnu (and SPEC on ppc-darwin). This patch is independent of "lno branch merge -- vectorizer patch #3", so there are a few common changes that both patches make in tree-vectorizer.c (specifically the changes to vect_create_data_ref, vect_create_addr_base_for_vector_ref, vect_create_index_for_vector_ref). The comments in this posting - http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00998.html apply to this patch as well, except for the following: > (2) I did not systematically add consideration of the new > ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF wherever > INDIRECT_REF is considered; I did address this issue in this patch for mainline. There were several places that I wasn't sure about, and/or where I don't expect that the new tree-codes should be encountered there, and/or where ignoring the new tree-codes may at worst result in a missed optimization: is_gimple_min_lval in tree-gimple.c (ok to add the new tree-codes there?), and a few places where INDIRECT_REFS are considered in expr.c, fold-const.c, gimplify.c, emit-rtl.c, tree-mudflap.c, tree-inline.c, varasm.c, c-typeck.c, c-common.c, tree-ssa-pre.c, tree-ssa-ccp.c, tree-sra.c, tree-ssa-names.c and tree.c. > (3) The function vect_create_data_ref used to return a ... > This change triggered a failure in vect-6.c, which seems to be > caused by a problem in DCE that has been fixed on mainline. I > disabled it for now, and will verify that it passes when I port > this patch to mainline. vect-6.c indeed passes correctly on mainline with this patch. With this patch 3 new testcases are vectorized: vect-72.c (new testcase), and vect-[27,48].c (which are currently only vectorized for ppc because the i386 support models the addr_misaligned only for chars). I may not read emails before Sunday because of the holidays here thanks, dorit Changelog: * tree.def (ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF): New tree-codes. * tree.h (REF_ORIGINAL): Consider ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF. * alias.c (get_alias_set, nonoverlapping_memrefs_p): Likewise. * expr.c (safe_from_p, expand_expr_real_1, rewrite_address_base) (find_interesting_uses_address): Likewise. * tree-ssa-loop-ivopts.c (peel_address, find_interesting_uses_address): (add_address_candidates, rewrite_address_base): Likewise. * tree-pretty-print.c (op_prio): Likewise. (dump_generic_node): Likewise. * tree-ssa-operands.c (get_expr_operands, get_indirect_ref_operands): Likewise. * fold-const.c (non_lvalue, operand_equal_p): Likewise. (build_fold_addr_expr_with_type): Likewise. * gimplify.c (gimplify_addr_expr, gimplify_expr): Likewise. * print-rtl.c (print_mem_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (tree_could_trap_p): Likewise. * tree-gimple.c (is_gimple_addressable, get_base_address): Likewise. * tree-ssa-alias.c (find_ptr_dereference, ptr_is_dereferenced_by): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (for_each_index): Likewise. * tree.c (staticp, build1_stat): Likewise. * emit-rtl.c (mem_expr_equal_p, set_mem_attributes_minus_bitpos): Likewise. * tree.def (REALIGN_LOAD_EXPR, REALIGN_STORE_EXPR): New tree-codes. * tree-pretty-print.c (dump_generic_node): Consider REALIGN_LOAD_EXPR. * tree-ssa-operands.c (get_expr_operands): Likewise. * expr.c (expand_expr_real_1): Likewise. * optabs.h (vec_realign_store_optab, vec_realign_load_optab) (addr_floor_optab, addr_misaligned_optab): New optabs. (OTI_vec_realign_store, OTI_vec_realign_load, OTI_addr_floor) (OTI_addr_misaligned): New optab_index values for the new optabs. (expand_realign_op, expand_addr_floor_op, expand_addr_misaligned_op): Declaration for new functions. * genopinit.c (optabs): Handle the new optabs. * optabs.c (optab_for_tree_code): Add cases for the new tree-codes. (init_optabs): Initialize vec_realign_load_optab, addr_floor_optab and addr_misaligned_optab. (expand_realign_op, expand_addr_floor_op, expand_addr_misaligned_op): New functions. * builtin-types.def (BT_CHAR_VECTOR, BT_FN_CHAR_VECTOR_PTR): New types. * builtins.def (BUILT_IN_BUILD_VECTOR_MASK_FOR_LOAD): New builtin. (BUILT_IN_BUILD_CC_MASK_FOR_LOAD): New builtin. * builtins.c (expand_builtin_build_mask_for_load): New function. (exapnd_builtin): New cases for BUILT_IN_BUILD_VECTOR_MASK_FOR_LOAD and BUILT_IN_BUILD_CC_MASK_FOR_LOAD. * config/rs6000/altivec.md (build_vector_mask_for_load): New define_expand. (addr_floor_v4si, addr_floor_v4sf, addr_floor_v4hi, addr_floor_v16qi): New define_expand. (vec_realign_load_v4si, vec_realign_load_v4sf, vec_realign_load_v8hi) (vec_realign_load_v16qi): New define_insn. * config/i386/i386.md (addr_misaligned_v16qi): New define_expand. * tree-vectorizer.c (vect_create_data_ref): Renamed to vect_create_data_ref_ptr. Returns pointer instead of an array-ref. Some of the functionality moved to vect_create_addr_base_for_vector_ref. (vect_create_index_for_vector_ref): Take a loop instead of a stmt as argument. Index always starts from 0. (vect_create_addr_base_for_vector_ref): New function. Creates initial address expression &(base[init_val]). This functionality was previously in vect_create_data_ref. (vectorizable_store): Call vect_create_data_ref_ptr with additional arguments, and create an indirect_ref with its return value data_ref. Check aligned_access_p. (vectorizable_load): Handle misaligned loads, using software-pipelined scheme with REALIGN_LOAD_EXPR and ALIGN_INDIRECT_REF if vec_realign_load_optab and addr_floor_optab are supported, or using regular scheme (without software-pipelining) with MISALIGNED_INDIRECT_REF if addr_misaligned_optab is supported. (BUILT_IN_build_mask_for_load): New variable. (vect_enhance_data_refs_alignment): Rename loop_vinfo to loop_info. (vect_analyze_data_refs_alignment): Don't fail vectorization in the presence of misaligned loads. (vect_analyze_data_ref_access): Add check for constant init. (vect_finish_stmt_generation): Typo. (vect_init_vector): Use bsi_insert_on_edge_immediate. (vectorize_loops): No need for loop_commit_inserts. (See attached file: vect-72.c)(See attached file: patch.mainline.Sept15)
Attachment:
vect-72.c
Description: Binary data
Attachment:
patch.mainline.Sept15
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |