[55/77] Use scalar_int_mode in simplify_const_unary_operation
commit0a398c03870b27be37d9f76bc3ff03b497146944
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Aug 2017 11:18:02 +0000 (30 11:18 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Aug 2017 11:18:02 +0000 (30 11:18 +0000)
tree57fa235f3897bab7e0a51a665855058d39d292d4
parent4c9e65ea19b29933df522694c46d7f6be545b6dc
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251507 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/simplify-rtx.c