This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use signed boolean type for boolean vectors
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 3 Nov 2015 14:42:15 +0100
- Subject: Re: [PATCH] Use signed boolean type for boolean vectors
- Authentication-results: sourceware.org; auth=none
- References: <20151028131339 dot GC20857 at msticlxl57 dot ims dot intel dot com> <CAFiYyc1B2Jgt_qHSvnSviuhzn1CVoAqRqoJNMOYu7F=ZQa5xNg at mail dot gmail dot com> <CAMbmDYbRqh6a8wGk2HYtn0GqwanV6=Yf9cqCZPsDvp_D2AkwkA at mail dot gmail dot com>
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