diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-03 07:16:28 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-03 07:16:28 +0000 |
commit | 062d5ccc1180aa6bca717309d26408a029af1fd7 (patch) | |
tree | 28241ae886e345168496960efb14a73002a657a2 /gcc/tree-vect-stmts.c | |
parent | cf1b2ba4ea9ee4b27e341c3f704416dc77d7172f (diff) | |
download | gcc-062d5ccc1180aa6bca717309d26408a029af1fd7.zip gcc-062d5ccc1180aa6bca717309d26408a029af1fd7.tar.gz gcc-062d5ccc1180aa6bca717309d26408a029af1fd7.tar.bz2 |
poly_int: vectorizable_conversion
This patch makes vectorizable_conversion cope with variable-length
vectors. We already require the number of elements in one vector
to be a multiple of the number of elements in the other vector,
so the patch uses that to choose between widening and narrowing.
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-vect-stmts.c (vectorizable_conversion): Treat the number
of units as polynomial. Choose between WIDE and NARROW based
on multiple_p.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256139
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r-- | gcc/tree-vect-stmts.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 6035261..249f69f 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -4115,8 +4115,8 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi, int ndts = 2; gimple *new_stmt = NULL; stmt_vec_info prev_stmt_info; - int nunits_in; - int nunits_out; + poly_uint64 nunits_in; + poly_uint64 nunits_out; tree vectype_out, vectype_in; int ncopies, i, j; tree lhs_type, rhs_type; @@ -4251,12 +4251,15 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi, nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in); nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out); - if (nunits_in < nunits_out) - modifier = NARROW; - else if (nunits_out == nunits_in) + if (known_eq (nunits_out, nunits_in)) modifier = NONE; + else if (multiple_p (nunits_out, nunits_in)) + modifier = NARROW; else - modifier = WIDEN; + { + gcc_checking_assert (multiple_p (nunits_in, nunits_out)); + modifier = WIDEN; + } /* Multiple types in SLP are handled by creating the appropriate number of vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in |