diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-13 17:57:25 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-13 17:57:25 +0000 |
commit | 695da53448dcc40e1e5db83bcf14d16217ffbd4a (patch) | |
tree | 653ae8366d4a3351466cfc904a7623b71b73a233 /gcc/stor-layout.c | |
parent | 779fed5fdb6098e67213a82dfd27f5b326a75e88 (diff) | |
download | gcc-695da53448dcc40e1e5db83bcf14d16217ffbd4a.zip gcc-695da53448dcc40e1e5db83bcf14d16217ffbd4a.tar.gz gcc-695da53448dcc40e1e5db83bcf14d16217ffbd4a.tar.bz2 |
Give the target more control over ARRAY_TYPE modes
So far we've used integer modes for LD[234] and ST[234] arrays.
That doesn't scale well to SVE, since the sizes aren't fixed at
compile time (and even if they were, we wouldn't want integers
to be so wide).
This patch lets the target use double-, triple- and quadruple-length
vectors instead.
2018-01-13 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* target.def (array_mode): New target hook.
* doc/tm.texi.in (TARGET_ARRAY_MODE): New hook.
* doc/tm.texi: Regenerate.
* hooks.h (hook_optmode_mode_uhwi_none): Declare.
* hooks.c (hook_optmode_mode_uhwi_none): New function.
* tree-vect-data-refs.c (vect_lanes_optab_supported_p): Use
targetm.array_mode.
* stor-layout.c (mode_for_array): Likewise. Support polynomial
type sizes.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256617
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r-- | gcc/stor-layout.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 58ebd6c..0f65e16 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -546,7 +546,8 @@ static machine_mode mode_for_array (tree elem_type, tree size) { tree elem_size; - unsigned HOST_WIDE_INT int_size, int_elem_size; + poly_uint64 int_size, int_elem_size; + unsigned HOST_WIDE_INT num_elems; bool limit_p; /* One-element arrays get the component type's mode. */ @@ -555,14 +556,16 @@ mode_for_array (tree elem_type, tree size) return TYPE_MODE (elem_type); limit_p = true; - if (tree_fits_uhwi_p (size) && tree_fits_uhwi_p (elem_size)) + if (poly_int_tree_p (size, &int_size) + && poly_int_tree_p (elem_size, &int_elem_size) + && maybe_ne (int_elem_size, 0U) + && constant_multiple_p (int_size, int_elem_size, &num_elems)) { - int_size = tree_to_uhwi (size); - int_elem_size = tree_to_uhwi (elem_size); - if (int_elem_size > 0 - && int_size % int_elem_size == 0 - && targetm.array_mode_supported_p (TYPE_MODE (elem_type), - int_size / int_elem_size)) + machine_mode elem_mode = TYPE_MODE (elem_type); + machine_mode mode; + if (targetm.array_mode (elem_mode, num_elems).exists (&mode)) + return mode; + if (targetm.array_mode_supported_p (elem_mode, num_elems)) limit_p = false; } return mode_for_size_tree (size, MODE_INT, limit_p).else_blk (); |