This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Try vector<bool> as a new representation for vector masks
- 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: Fri, 18 Sep 2015 14:22:22 +0200
- Subject: Re: [RFC] Try vector<bool> as a new representation for vector masks
- Authentication-results: sourceware.org; auth=none
- References: <55D62076 dot 8020105 at redhat dot com> <CAFiYyc1wqw4zxP-RTwH8CTou0BLxmya1nX0dSCokteebRJ54OA at mail dot gmail dot com> <CAMbmDYZ-dvygua8G0m6qCQ43YUNkG7DJZj7tRY2aXX4wV+_y1g at mail dot gmail dot com> <CAFiYyc0xd4bN7kRqNomeijYX6TCSRxz3kpmBAvGnfRmWydfg9Q at mail dot gmail dot com> <CAMbmDYa0uARbRzyZWbud1YrpLZEV+11=wWEt7vVZFcxhZD0kWw at mail dot gmail dot com> <CAFiYyc38xisFJJndJ7yKsUbGciyq+NDNyCJzq_X46dK+9VsWWQ at mail dot gmail dot com> <CAMbmDYaT2v1UbDGPFz5_OiV=45PsKOdGCJ=J6CBwqEQMe+JN-g at mail dot gmail dot com> <CAFiYyc218U_zN+hF-JyL_ok6FxzgsPjKD5BYzznGAH7z53t_eA at mail dot gmail dot com> <CAMbmDYbdehpCFjf-1D5ytfSPBwLEB9HD6-SUUNy9JSAyOe8qwA at mail dot gmail dot com> <CAFiYyc37e5HP-SvhPxjbT03rNRZU+HamD5taxY8K_Sv2nsREPw at mail dot gmail dot com> <20150901130800 dot GA55610 at msticlxl57 dot ims dot intel dot com> <CAFiYyc0_Ye853cYW9FjeKNkNKNLs69eonHBHq+E2cK28+ktz5Q at mail dot gmail dot com> <CAMbmDYafMuqzmRwRQfFHpLORFFGmFpfSRTR0QKx+LRFm6z75JQ at mail dot gmail dot com> <CAMbmDYbEAn=pzZrFd9AtLfJX8ugrijfz_=z8rJo88oaYmhKwbQ at mail dot gmail dot com> <CAFiYyc3+Zrda9eC4-=v4zmkNkry-DRrB9p=vWvr7c9e59OvjCQ at mail dot gmail dot com> <CAMbmDYYKX3dkYa0GWdydaAwGX4MJzQwFKRbk5WQXxOTpa3+-_w at mail dot gmail dot com>
On Thu, Sep 3, 2015 at 3:57 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> 2015-09-03 15:11 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
>> On Thu, Sep 3, 2015 at 2:03 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>>> Adding CCs.
>>>
>>> 2015-09-03 15:03 GMT+03:00 Ilya Enkovich <enkovich.gnu@gmail.com>:
>>>> 2015-09-01 17:25 GMT+03:00 Richard Biener <richard.guenther@gmail.com>:
>>>>
>>>> Totally disabling old style vector comparison and bool pattern is a
>>>> goal but doing hat would mean a lot of regressions for many targets.
>>>> Do you want to it to be tried to estimate amount of changes required
>>>> and reveal possible issues? What would be integration plan for these
>>>> changes? Do you want to just introduce new vector<bool> in GIMPLE
>>>> disabling bool patterns and then resolving vectorization regression on
>>>> all targets or allow them live together with following target switch
>>>> one by one from bool patterns with finally removing them? Not all
>>>> targets are likely to be adopted fast I suppose.
>>
>> Well, the frontends already create vec_cond exprs I believe. So for
>> bool patterns the vectorizer would have to do the same, but the
>> comparison result in there would still use vec<bool>. Thus the scalar
>>
>> _Bool a = b < c;
>> _Bool c = a || d;
>> if (c)
>>
>> would become
>>
>> vec<int> a = VEC_COND <a < b ? -1 : 0>;
>> vec<int> c = a | d;
>
> This should be identical to
>
> vec<_Bool> a = a < b;
> vec<_Bool> c = a | d;
>
> where vec<_Bool> has VxSI mode. And we should prefer it in case target
> supports vector comparison into vec<bool>, right?
>
>>
>> when the target does not have vec<bool>s directly and otherwise
>> vec<boo> directly (dropping the VEC_COND).
>>
>> Just the vector comparison inside the VEC_COND would always
>> have vec<bool> type.
>
> I don't really understand what you mean by 'doesn't have vec<bool>s
> dirrectly' here. Currently I have a hook to ask for a vec<bool> mode
> and assume target doesn't support it in case it returns VOIDmode. But
> in such case I have no mode to use for vec<bool> inside VEC_COND
> either.
I was thinking about targets not supporting generating vec<bool>
(of whatever mode) from a comparison directly but only via
a COND_EXPR.
> In default implementation of the new target hook I always return
> integer vector mode (to have default behavior similar to the current
> one). It should allow me to use vec<bool> for conditions in all
> vec_cond. But we'd need some other trigger for bool patterns to apply.
> Probably check vec_cmp optab in check_bool_pattern and don't convert
> in case comparison is supported by target? Or control it via
> additional hook.
Not sure if we are always talking about the same thing for
"bool patterns". I'd remove bool patterns completely, IMHO
they are not necessary at all.
>>
>> And the "bool patterns" I am talking about are those in
>> tree-vect-patterns.c, not any targets instruction patterns.
>
> I refer to them also. BTW bool patterns also pull comparison into
> vec_cond. Thus we cannot have SSA_NAME in vec_cond as a condition. I
> think with vector comparisons in place we should allow SSA_NAME as
> conditions in VEC_COND for better CSE. That should require new vcond
> optabs though.
I think we do allow this, just the vectorizer doesn't expect it. In the long
run I want to get rid of the GENERIC exprs in both COND_EXPR and
VEC_COND_EXPR. Just didn't have the time to do this...
Richard.
> Ilya
>
>>
>> Richard.
>>
>>>>
>>>> Ilya