On 07/13/2017 02:58 AM, Richard Sandiford wrote: > 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-07-13 Richard Sandiford <richard.sandif...@linaro.org> > Alan Hayward <alan.hayw...@arm.com> > David Sherwood <david.sherw...@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. OK. jeff