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] Use signed boolean type for boolean vectors


On Wed, Oct 28, 2015 at 4:30 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> 2015-10-28 18:21 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
>> On Wed, Oct 28, 2015 at 2:13 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>>> Hi,
>>>
>>> Testing boolean vector conversions I found several runtime regressions
>>> and investigation showed it's due to incorrect conversion caused by
>>> unsigned boolean type.  When boolean vector is represented as an
>>> integer vector on target it's a signed integer actually.  Unsigned
>>> boolean type was chosen due to possible single bit values, but for
>>> multiple bit values it causes wrong casting.  The easiest way to fix
>>> it is to use signed boolean value.  The following patch does this and
>>> fixes my problems with conversion.  Bootstrapped and tested on
>>> x86_64-unknown-linux-gnu.  Is it OK?
>>
>> Hmm.  Actually formally the "boolean" vectors were always 0 or -1
>> (all bits set).  That is also true for a signed boolean with precision 1
>> but with higher precision what makes sure to sign-extend 'true'?
>>
>> So it's far from an obvious change, esp as you don't change the
>> precision == 1 case.  [I still think we should have precision == 1
>> for all boolean types]
>>
>> Richard.
>>
>
> For 1 bit precision signed type value 1 is out of range, right? This might break
> in many place due to used 1 as true value.

For vectors -1 is true.  Did you try whether it breaks many places?
build_int_cst (type, 1) should still work fine.

Richard.

>
> Ilya


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