This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix problematic folding
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Eric Botcazou" <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 1 Aug 2008 17:16:55 +0200
- Subject: Re: [PATCH] Fix problematic folding
- References: <200807311946.49872.ebotcazou@adacore.com> <Pine.LNX.4.64.0807311943160.19501@digraph.polyomino.org.uk> <200808011714.21446.ebotcazou@adacore.com>
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
>