Generalise VEC_DUPLICATE folding for variable-length vectors
commit708cc6132bb374e2c5bd1c4f43f9fe7306d20970
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 29 Jul 2019 08:42:19 +0000 (29 08:42 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 29 Jul 2019 08:42:19 +0000 (29 08:42 +0000)
tree97cf7a6d5112e03267943b02aaf4d57e97afb6ef
parent4ce6ab6889446984fd7017e2150962eb4550a7ee
Generalise VEC_DUPLICATE folding for variable-length vectors

This patch uses the constant vector encoding scheme to handle
more cases of a VEC_DUPLICATE of another vector.  Duplicating
any fixed-length vector is fine, and duplicating a variable-length
vector is OK as long as that vector is also a duplicate of a
fixed-length sequence.

Other cases fell through to:

  if (VECTOR_MODE_P (mode) && GET_CODE (op) == CONST_VECTOR)

which was only expecting to deal with elementwise operations.

2019-07-29  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* simplify-rtx.c (simplify_const_unary_operation): Fold a
VEC_DUPLICATE of a fixed-length vector even if the result
is variable-length.  Likewise fold a duplicate of a
variable-length vector if the variable-length vector is
itself a duplicate of a fixed-length sequence.
(test_vector_ops_duplicate): Test more cases.

From-SVN: r273868
gcc/ChangeLog
gcc/simplify-rtx.c