This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve folding of bitwise ops on booleans
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 4 Jun 2013 20:51:33 +0200
- Subject: Re: [PATCH] Improve folding of bitwise ops on booleans
- References: <51A90588 dot 5080807 at redhat dot com> <CAFiYyc3yxAs0vV8qS830ubnprJSs5o4RCD+S9Pzkink_VPRzGw at mail dot gmail dot com> <51ACBEB8 dot 70005 at redhat dot com> <CAFiYyc2LZcLjJLOTbsdepUrjUsPHp8NAGk7XrNiDRYnD+DyQ_A at mail dot gmail dot com> <51AE34C9 dot 5040108 at redhat dot com>
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