Use (CONST_VECTOR|GET_MODE)_NUNITS in simplify-rtx.c
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 1 Nov 2017 14:06:50 +0000 (14:06 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 1 Nov 2017 14:06:50 +0000 (14:06 +0000)
commitcb8e3dda35164dcb85056556779daa673b40166a
tree9e495e9d8e1dfea243a6580db21d16fb76b82b37
parentd6dd9d7f8efcf92c5c70a9e91e99a9719b31cd51
Use (CONST_VECTOR|GET_MODE)_NUNITS in simplify-rtx.c

This patch avoids some calculations of the form:

  GET_MODE_SIZE (vector_mode) / GET_MODE_SIZE (element_mode)

in simplify-rtx.c.  If we're dealing with CONST_VECTORs, it's better
to use CONST_VECTOR_NUNITS, since that remains constant even after the
SVE patches.  In other cases we can get the number from GET_MODE_NUNITS.

2017-11-01  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* simplify-rtx.c (simplify_const_unary_operation): Use GET_MODE_NUNITS
and CONST_VECTOR_NUNITS instead of computing the number of units from
the byte sizes of the vector and element.
(simplify_binary_operation_1): Likewise.
(simplify_const_binary_operation): Likewise.
(simplify_ternary_operation): Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254311
gcc/ChangeLog
gcc/simplify-rtx.c