diff options
author | Ulrich Weigand <ulrich.weigand@linaro.org> | 2012-07-30 14:39:32 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@gcc.gnu.org> | 2012-07-30 14:39:32 +0000 |
commit | 5aea1e76a80c9c5770692ece18100b9383cbab3a (patch) | |
tree | dc5799dbc1af4d3d79e2dbe5b4f3915b5afa6052 /gcc/tree-vect-loop-manip.c | |
parent | 4c340b5dfa736102f1fc50f3a4f2ba685708c7ff (diff) | |
download | gcc-5aea1e76a80c9c5770692ece18100b9383cbab3a.zip gcc-5aea1e76a80c9c5770692ece18100b9383cbab3a.tar.gz gcc-5aea1e76a80c9c5770692ece18100b9383cbab3a.tar.bz2 |
target.def (vector_alignment): New target hook.
ChangeLog:
* target.def (vector_alignment): New target hook.
* doc/tm.texi.in (TARGET_VECTOR_ALIGNMENT): Document new hook.
* doc/tm.texi: Regenerate.
* targhooks.c (default_vector_alignment): New function.
* targhooks.h (default_vector_alignment): Add prototype.
* stor-layout.c (layout_type): Use targetm.vector_alignment.
* config/arm/arm.c (arm_vector_alignment): New function.
(TARGET_VECTOR_ALIGNMENT): Define.
* tree-vect-data-refs.c (vect_update_misalignment_for_peel): Use
vector type alignment instead of size.
* tree-vect-loop-manip.c (vect_do_peeling_for_loop_bound): Use
element type size directly instead of computing it from alignment.
Fix variable naming and comment.
testsuite/ChangeLog:
* lib/target-supports.exp
(check_effective_target_vect_natural_alignment): New function.
* gcc.dg/align-2.c: Only run on targets with natural alignment
of vector types.
* gcc.dg/vect/slp-25.c: Adjust tests for targets without natural
alignment of vector types.
Co-Authored-By: Richard Earnshaw <rearnsha@arm.com>
From-SVN: r189974
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index d7d9f25..0008116 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -1937,7 +1937,7 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio, If the misalignment of DR is known at compile time: addr_mis = int mis = DR_MISALIGNMENT (dr); Else, compute address misalignment in bytes: - addr_mis = addr & (vectype_size - 1) + addr_mis = addr & (vectype_align - 1) prolog_niters = min (LOOP_NITERS, ((VF - addr_mis/elem_size)&(VF-1))/step) @@ -1991,9 +1991,10 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters) tree start_addr = vect_create_addr_base_for_vector_ref (dr_stmt, &new_stmts, offset, loop); tree type = unsigned_type_for (TREE_TYPE (start_addr)); - tree vectype_size_minus_1 = build_int_cst (type, vectype_align - 1); - tree elem_size_log = - build_int_cst (type, exact_log2 (vectype_align/nelements)); + tree vectype_align_minus_1 = build_int_cst (type, vectype_align - 1); + HOST_WIDE_INT elem_size = + int_cst_value (TYPE_SIZE_UNIT (TREE_TYPE (vectype))); + tree elem_size_log = build_int_cst (type, exact_log2 (elem_size)); tree nelements_minus_1 = build_int_cst (type, nelements - 1); tree nelements_tree = build_int_cst (type, nelements); tree byte_misalign; @@ -2002,10 +2003,10 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters) new_bb = gsi_insert_seq_on_edge_immediate (pe, new_stmts); gcc_assert (!new_bb); - /* Create: byte_misalign = addr & (vectype_size - 1) */ + /* Create: byte_misalign = addr & (vectype_align - 1) */ byte_misalign = fold_build2 (BIT_AND_EXPR, type, fold_convert (type, start_addr), - vectype_size_minus_1); + vectype_align_minus_1); /* Create: elem_misalign = byte_misalign / element_size */ elem_misalign = |