[PATCH] Fix problematic folding

Richard Guenther richard.guenther@gmail.com
Fri Aug 1 15:17:00 GMT 2008


On Fri, Aug 1, 2008 at 5:14 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> The target-independent semantics of integer arithmetic on trees or tuples
>> should be based on the precision not the mode; A+1 *should* wrap around.
>> reduce_to_bit_field_precision is meant to ensure this when we expand to
>> RTL; you could always lower (to arithmetic based only on types natively
>> supported by the machine) at some other time if that were in some way
>> beneficial, but if such types are present in the trees then their
>> semantics should depend on the precision.
>
> That's only true for integer types (INTEGER_TYPE), not for the other integral
> types (in particular BOOLEAN_TYPE)
>
>  /* An operation in what may be a bit-field type needs the
>     result to be reduced to the precision of the bit-field type,
>     which is narrower than that of the type's mode.  */
>  reduce_bit_field = (!ignore
>                      && TREE_CODE (type) == INTEGER_TYPE
>                      && GET_MODE_PRECISION (mode) > TYPE_PRECISION (type));

That obviously needs to be INTEGRAL_TYPE_P as the middle-end
willy-nilly can substitute one integral kind for another.

Richard.

> so there is a discrepancy with the folder.  I guess the question is whether
> boolean arithmetics makes some sense in the middle-end.
>
> --
> Eric Botcazou
>



More information about the Gcc-patches mailing list