This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix problematic folding


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]