This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Scalar masks 2/x] Use bool masks in if-conversion
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Aug 2015 15:08:56 +0200
- Subject: Re: [Scalar masks 2/x] Use bool masks in if-conversion
- Authentication-results: sourceware.org; auth=none
- References: <20150817162544 dot GB12565 at msticlxl57 dot ims dot intel dot com> <55D62076 dot 8020105 at redhat dot com> <CAFiYyc1wqw4zxP-RTwH8CTou0BLxmya1nX0dSCokteebRJ54OA at mail dot gmail dot com> <CAMbmDYZ-dvygua8G0m6qCQ43YUNkG7DJZj7tRY2aXX4wV+_y1g at mail dot gmail dot com> <55DCE12C dot 3070300 at redhat dot com> <CAMbmDYYNb1p79N7EE=3ye+5rT6JRjx-JpOqKyaHs0E645=fwOg at mail dot gmail dot com>
On Wed, Aug 26, 2015 at 1:13 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> 2015-08-26 0:42 GMT+03:00 Jeff Law <law@redhat.com>:
>> On 08/21/2015 04:49 AM, Ilya Enkovich wrote:
>>>
>>>
>>> I want a work with bitmasks to be expressed in a natural way using
>>> regular integer operations. Currently all masks manipulations are
>>> emulated via vector statements (mostly using a bunch of vec_cond). For
>>> complex predicates it may be nontrivial to transform it back to scalar
>>> masks and get an efficient code. Also the same vector may be used as
>>> both a mask and an integer vector. Things become more complex if you
>>> additionally have broadcasts and vector pack/unpack code. It also
>>> should be transformed into a scalar masks manipulations somehow.
>>
>> Or why not model the conversion at the gimple level using a CONVERT_EXPR?
>> In fact, the more I think about it, that seems to make more sense to me.
>>
>> We pick a canonical form for the mask, whatever it may be. We use that
>> canonical form and model conversions between it and the other form via
>> CONVERT_EXPR. We then let DOM/PRE find/eliminate the redundant conversions.
>> If it's not up to the task, we should really look into why and resolve.
>>
>> Yes, that does mean we have two forms which I'm not terribly happy about and
>> it means some target dependencies on what the masked vector operation looks
>> like (ie, does it accept a simple integer or vector mask), but I'm starting
>> to wonder if, as distasteful as I find it, it's the right thing to do.
>
> If we have some special representation for masks in GIMPLE then we
> might not need any conversions. We could ask a target to define a MODE
> for this type and use it directly everywhere: directly compare into
> it, use it directly for masked loads and stores, AND, IOR, EQ etc. If
> that type is reserved for masks usage then you previous suggestion to
> transform masks into target specific form at GIMPLE->RTL phase should
> work fine. This would allow to support only a single masks
> representation in GIMPLE.
But we can already do all this with the integer vector masks we have.
If you think that the vectorizer generated
mask = VEC_COND <v1 < v2 ? { -1,...} : { 0, ...} >
is ugly then we can remove that implementation detail and use
mask = v1 < v2;
directly. Note that the VEC_COND form was invented to avoid
the need to touch RTL expansion for vector compares (IIRC).
Or it pre-dated specifying what compares generate on GIMPLE.
Richard.
> Thanks,
> Ilya
>
>>
>>>>
>>>> But I don't like changing our IL so much as to allow 'integer' masks
>>>> everywhere.
>>
>> I'm warming up to that idea...
>>
>> jeff
>>