[55/77] Use scalar_int_mode in simplify_const_unary_operation
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 30 Aug 2017 11:18:02 +0000 (11:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 30 Aug 2017 11:18:02 +0000 (11:18 +0000)
commit40c4ef22a7b4b70c64d5ce09d9fc5fba60b49420
tree57fa235f3897bab7e0a51a665855058d39d292d4
parent3c84109eae52da59c09e8a91bfb5e79bd0527809
[55/77] Use scalar_int_mode in simplify_const_unary_operation

The main scalar integer block in simplify_const_unary_operation
had the condition:

  if (CONST_SCALAR_INT_P (op) && width > 0)

where "width > 0" was a roundabout way of testing != VOIDmode.
This patch replaces it with a check for a scalar_int_mode instead.
It also uses the number of bits in the input rather than the output
mode to determine the result of a "count ... bits in zero" operation.
(At the momemnt these modes have to be the same, but it still seems
conceptually wrong to use the number of bits in the output mode.)

The handling of float->integer ops also checked "width > 0",
but this was redundant with the earlier check for MODE_INT.

2017-08-30  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
is_a <scalar_int_mode> instead of checking for a nonzero
precision.  Forcibly convert op_mode to a scalar_int_mode
in that case.  More clearly differentiate the operand and
result modes and use the former when deciding what the value
of a count-bits operation should be.  Use is_int_mode instead
of checking for a MODE_INT.  Remove redundant check for whether
this mode has a zero precision.

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