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] Improve folding of bitwise ops on booleans


2013/6/4 Jeff Law <law@redhat.com>:
> On 06/04/2013 04:45 AM, Richard Biener wrote:
>>>
>>>
>>> Yes.  Booleans are integral types with a single bit of precision, right?
>>> So
>>> this check should allow boolean types.  What am I missing?
>>
>>
>> We have BOOLEAN_TYPEs that do not have a TYPE_PRECISION of one
>> (but still are two-valued, and we assume those values are 0 and != 0
>> (eh)).
>> So there is code that treats BOOLEAN_TYPEs the same as TYPE_PRECISION
>> one types and there is code that does not (for example bitwise not is not
>> equal to truth not on such types).
>
> Good grief.  For a boolean with a TYPE_PRECISION != 1, I think we can apply
> the transformations if the type is unsigned.  Once the type is signed I
> think we'd lose.
>
> Do you have any sample code which would create a boolean type with a
> precision other than 1?
>
> jeff
>

AFAI recall, the boolean-type in Ada has 8-bit precision.  I think we
have to omit this transformations for any boolean-type with
type-precision not equal to 1.  Ada uses the other values for
sanity-check AFAIR.

Kai


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