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