[PATCH, PR middle-end/71488] Fix vectorization of comparison of booleans

Ilya Enkovich enkovich.gnu@gmail.com
Mon Jun 27 16:51:00 GMT 2016


Looks like it caused PR71655 and therefore is not so safe :/

Ilya

2016-06-22 17:00 GMT+03:00 Ilya Enkovich <enkovich.gnu@gmail.com>:
> 2016-06-21 23:57 GMT+03:00 Jeff Law <law@redhat.com>:
>> On 06/16/2016 05:06 AM, Ilya Enkovich wrote:
>>>
>>> Hi,
>>>
>>> This patch fixes incorrect comparison vectorization for booleans.
>>> The problem is that regular comparison which works for scalars
>>> doesn't work for vectors due to different binary representation.
>>> Also this never works for scalar masks.
>>>
>>> This patch replaces such comparisons with bitwise operations
>>> which work correctly for both vector and scalar masks.
>>>
>>> Bootstrapped and regtested on x86_64-unknown-linux-gnu.  Is it
>>> OK for trunk?  What should be done for gcc-6-branch?  Port this
>>> patch or just restrict vectorization for comparison of booleans?
>>>
>>> Thanks,
>>> Ilya
>>> --
>>> gcc/
>>>
>>> 2016-06-15  Ilya Enkovich  <ilya.enkovich@intel.com>
>>>
>>>         PR middle-end/71488
>>>         * tree-vect-patterns.c (vect_recog_mask_conversion_pattern):
>>> Support
>>>         comparison of boolean vectors.
>>>         * tree-vect-stmts.c (vectorizable_comparison): Vectorize
>>> comparison
>>>         of boolean vectors using bitwise operations.
>>>
>>> gcc/testsuite/
>>>
>>> 2016-06-15  Ilya Enkovich  <ilya.enkovich@intel.com>
>>>
>>>         PR middle-end/71488
>>>         * g++.dg/pr71488.C: New test.
>>>         * gcc.dg/vect/vect-bool-cmp.c: New test.
>>
>> OK.  Given this is a code generation bug, I'll support porting this patch to
>> the gcc-6 branch.  Is there any reason to think that porting out be more
>> risky than usual?  It looks pretty simple to me, am I missing some subtle
>> dependency?
>
> I don't feel this patch is too risky.  I asked only because simple restriction
> on masks comparison is even more safe.
>
> Thanks,
> Ilya
>
>
>>
>> jeff
>>



More information about the Gcc-patches mailing list