[PATCH] simplify-rtx.c: Change BITSIZE to UNIT_PRECISION in simplification

Jeff Law law@redhat.com
Wed Jul 3 22:35:00 GMT 2019


On 7/3/19 2:17 PM, Richard Sandiford wrote:
>> diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
>> index 89a46a9..d74a4ba 100644
>> --- a/gcc/simplify-rtx.c
>> +++ b/gcc/simplify-rtx.c
>> @@ -1504,12 +1504,12 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
>>  	  && CONST_INT_P (XEXP (op, 1))
>>  	  && XEXP (XEXP (op, 0), 1) == XEXP (op, 1)
>>  	  && (op_mode = as_a <scalar_int_mode> (GET_MODE (op)),
>> -	      GET_MODE_BITSIZE (op_mode) > INTVAL (XEXP (op, 1))))
>> +	      GET_MODE_UNIT_PRECISION (op_mode) > INTVAL (XEXP (op, 1))))
>>  	{
>>  	  scalar_int_mode tmode;
>> -	  gcc_assert (GET_MODE_BITSIZE (int_mode)
>> -		      > GET_MODE_BITSIZE (op_mode));
>> -	  if (int_mode_for_size (GET_MODE_BITSIZE (op_mode)
>> +	  gcc_assert (GET_MODE_UNIT_PRECISION (int_mode)
>> +		      > GET_MODE_UNIT_PRECISION (op_mode));
>> +	  if (int_mode_for_size (GET_MODE_UNIT_PRECISION (op_mode)
>>  				 - INTVAL (XEXP (op, 1)), 1).exists (&tmode))
>>  	    {
>>  	      rtx inner =
> 
> I think these should be GET_MODE_PRECISION rather than
> GET_MODE_UNIT_PRECISION.  They do the same thing in this context,
> but it seems odd to use GET_MODE_UNIT_... when we're specifically
> dealing with scalars.
> 
> Looks good otherwise (and small enough not to need a copyright assignment,
> in case you haven't signed one).
John, I assume you're doing this for an out of tree port (s12z?)?
Otherwise it'd also be useful if you could include a test which triggers
the assert.

If you could confirm that Richard's suggestion of using
GET_MODE_PRECISION rather than GET_MODE_UNIT_PRECISION works it'd be
appreciated.

Thanks,
jeff



More information about the Gcc-patches mailing list