diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-03 09:01:52 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-03 09:01:52 +0000 |
commit | 0ecc2b7db7480fa33d31d95a114b024809cb6883 (patch) | |
tree | 9003f8b5836a2167c157e9007befcc84ae24a173 /gcc/tree-vector-builder.c | |
parent | 6b0630fbe8c34255f2739f63a8d3e5b636020bf4 (diff) | |
download | gcc-0ecc2b7db7480fa33d31d95a114b024809cb6883.zip gcc-0ecc2b7db7480fa33d31d95a114b024809cb6883.tar.gz gcc-0ecc2b7db7480fa33d31d95a114b024809cb6883.tar.bz2 |
poly_int: vector_builder element count
This patch changes the number of elements in a vector being built
by a vector_builder from unsigned int to poly_uint64. The case
in which it isn't a constant is the one that motivated adding
the vector encoding in the first place.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* vector-builder.h (vector_builder::m_full_nelts): Change from
unsigned int to poly_uint64.
(vector_builder::full_nelts): Update prototype accordingly.
(vector_builder::new_vector): Likewise.
(vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
(vector_builder::operator ==): Likewise.
(vector_builder::finalize): Likewise.
* int-vector-builder.h (int_vector_builder::int_vector_builder):
Take the number of elements as a poly_uint64 rather than an
unsigned int.
* vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
from unsigned int to poly_uint64.
(vec_perm_indices::vec_perm_indices): Update prototype accordingly.
(vec_perm_indices::new_vector): Likewise.
(vec_perm_indices::length): Likewise.
(vec_perm_indices::nelts_per_input): Likewise.
(vec_perm_indices::input_nelts): Likewise.
* vec-perm-indices.c (vec_perm_indices::new_vector): Take the
number of elements per input as a poly_uint64 rather than an
unsigned int. Use the original encoding for variable-length
vectors, rather than clamping each individual element.
For the second and subsequent elements in each pattern,
clamp the step and base before clamping their sum.
(vec_perm_indices::series_p): Handle polynomial element counts.
(vec_perm_indices::all_in_range_p): Likewise.
(vec_perm_indices_to_tree): Likewise.
(vec_perm_indices_to_rtx): Likewise.
* tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
* tree-vector-builder.c (tree_vector_builder::new_unary_operation)
(tree_vector_builder::new_binary_operation): Handle polynomial
element counts. Return false if we need to know the number
of elements at compile time.
* fold-const.c (fold_vec_perm): Punt if the number of elements
isn't known at compile time.
From-SVN: r256165
Diffstat (limited to 'gcc/tree-vector-builder.c')
-rw-r--r-- | gcc/tree-vector-builder.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/tree-vector-builder.c b/gcc/tree-vector-builder.c index 88b9d1a..be25707 100644 --- a/gcc/tree-vector-builder.c +++ b/gcc/tree-vector-builder.c @@ -36,13 +36,15 @@ bool tree_vector_builder::new_unary_operation (tree type, tree t, bool allow_stepped_p) { - unsigned int full_nelts = TYPE_VECTOR_SUBPARTS (type); - gcc_assert (full_nelts == TYPE_VECTOR_SUBPARTS (TREE_TYPE (t))); + poly_uint64 full_nelts = TYPE_VECTOR_SUBPARTS (type); + gcc_assert (known_eq (full_nelts, TYPE_VECTOR_SUBPARTS (TREE_TYPE (t)))); unsigned int npatterns = VECTOR_CST_NPATTERNS (t); unsigned int nelts_per_pattern = VECTOR_CST_NELTS_PER_PATTERN (t); if (!allow_stepped_p && nelts_per_pattern > 2) { - npatterns = full_nelts; + if (!full_nelts.is_constant ()) + return false; + npatterns = full_nelts.to_constant (); nelts_per_pattern = 1; } new_vector (type, npatterns, nelts_per_pattern); @@ -61,9 +63,9 @@ bool tree_vector_builder::new_binary_operation (tree type, tree t1, tree t2, bool allow_stepped_p) { - unsigned int full_nelts = TYPE_VECTOR_SUBPARTS (type); - gcc_assert (full_nelts == TYPE_VECTOR_SUBPARTS (TREE_TYPE (t1)) - && full_nelts == TYPE_VECTOR_SUBPARTS (TREE_TYPE (t2))); + poly_uint64 full_nelts = TYPE_VECTOR_SUBPARTS (type); + gcc_assert (known_eq (full_nelts, TYPE_VECTOR_SUBPARTS (TREE_TYPE (t1))) + && known_eq (full_nelts, TYPE_VECTOR_SUBPARTS (TREE_TYPE (t2)))); /* Conceptually we split the patterns in T1 and T2 until we have an equal number for both. Each split pattern requires the same number of elements per pattern as the original. E.g. splitting: @@ -89,7 +91,9 @@ tree_vector_builder::new_binary_operation (tree type, tree t1, tree t2, VECTOR_CST_NELTS_PER_PATTERN (t2)); if (!allow_stepped_p && nelts_per_pattern > 2) { - npatterns = full_nelts; + if (!full_nelts.is_constant ()) + return false; + npatterns = full_nelts.to_constant (); nelts_per_pattern = 1; } new_vector (type, npatterns, nelts_per_pattern); |