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/stor-layout.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/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 0d3d5d2..ddec141 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2131,9 +2131,17 @@ layout_type (tree type) TYPE_SIZE (type) = int_const_binop (MULT_EXPR, TYPE_SIZE (innertype), bitsize_int (nunits)); - /* Always naturally align vectors. This prevents ABI changes - depending on whether or not native vector modes are supported. */ - TYPE_ALIGN (type) = tree_low_cst (TYPE_SIZE (type), 0); + /* For vector types, we do not default to the mode's alignment. + Instead, query a target hook, defaulting to natural alignment. + This prevents ABI changes depending on whether or not native + vector modes are supported. */ + TYPE_ALIGN (type) = targetm.vector_alignment (type); + + /* However, if the underlying mode requires a bigger alignment than + what the target hook provides, we cannot use the mode. For now, + simply reject that case. */ + gcc_assert (TYPE_ALIGN (type) + >= GET_MODE_ALIGNMENT (TYPE_MODE (type))); break; } |