public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ilya Enkovich <enkovich.gnu@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <law@redhat.com>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC] Try vector<bool> as a new representation for vector masks
Date: Fri, 18 Sep 2015 13:44:00 -0000	[thread overview]
Message-ID: <CAMbmDYZGQ0Znz0e01+wLT+-uaAno1Shq9D08eBoDKNxLoUjB8Q@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc2Qdxt3M7WfL5e598ZupwkLGHDbuNx_22yYFzYzo3L6hA@mail.gmail.com>

2015-09-18 15:22 GMT+03:00 Richard Biener <richard.guenther@gmail.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.

Where may these direct comparisons come from? Vectorizer never
generates unsupported statements. It means we get them from
gimplifier? So touch optabs in gimplifier to avoid direct comparisons?
Actually vect lowering checks if we are able to make comparison and
expand also uses vec_cond to expand vector comparison, so probably we
may live with them.

>
>> 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.

I refer to transformations made by vect_recog_bool_pattern. Don't see
how to remove them completely for targets not supporting comparison
vectorization.

>
>>>
>>> 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...

That would be nice. As a first step I'd like to support optabs for
VEC_COND_EXPR directly using vec<bool>.

Thanks,
Ilya

>
> Richard.
>
>> Ilya
>>
>>>
>>> Richard.
>>>
>>>>>
>>>>> Ilya

  reply	other threads:[~2015-09-18 13:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 16:27 [Scalar masks 2/x] Use bool masks in if-conversion Ilya Enkovich
2015-08-20 19:26 ` Jeff Law
2015-08-21  8:32   ` Richard Biener
2015-08-21 10:52     ` Ilya Enkovich
2015-08-21 11:15       ` Richard Biener
2015-08-21 12:19         ` Ilya Enkovich
2015-08-25 21:40           ` Jeff Law
2015-08-26 11:13             ` Ilya Enkovich
2015-08-26 13:09           ` Richard Biener
2015-08-26 13:21             ` Jakub Jelinek
2015-08-26 13:27               ` Richard Biener
2015-08-26 13:47                 ` Jakub Jelinek
2015-08-26 14:36                   ` Richard Biener
2015-08-26 14:51             ` Ilya Enkovich
2015-08-26 15:02               ` Richard Biener
2015-08-26 15:15                 ` Jakub Jelinek
2015-08-26 16:09                 ` Ilya Enkovich
2015-08-27  7:58                   ` Richard Biener
2015-09-01 13:13                     ` [RFC] Try vector<bool> as a new representation for vector masks Ilya Enkovich
2015-09-01 14:25                       ` Richard Biener
     [not found]                         ` <CAMbmDYafMuqzmRwRQfFHpLORFFGmFpfSRTR0QKx+LRFm6z75JQ@mail.gmail.com>
2015-09-03 12:12                           ` Ilya Enkovich
2015-09-03 12:42                             ` Richard Biener
2015-09-03 14:12                               ` Ilya Enkovich
2015-09-18 12:29                                 ` Richard Biener
2015-09-18 13:44                                   ` Ilya Enkovich [this message]
2015-09-23 13:46                                     ` Ilya Enkovich
2015-09-23 14:10                                       ` Richard Biener
2015-09-23 18:51                                         ` Richard Henderson
2015-09-24  8:40                                           ` Richard Biener
2015-09-24 16:55                                             ` Richard Henderson
2015-09-25  8:51                                               ` Richard Biener
2015-09-25 14:57                                         ` Ilya Enkovich
2015-09-23 13:50                                     ` Richard Biener
2015-09-04 20:47                       ` Jeff Law
2015-09-08 12:43                         ` Ilya Enkovich
2015-09-15 13:55                           ` Ilya Enkovich
2015-09-17 17:54                             ` Richard Henderson
2015-09-18 13:26                               ` Ilya Enkovich
2015-09-18 16:58                                 ` Richard Henderson
2015-09-21 12:21                                   ` Ilya Enkovich
2015-09-21 17:40                                     ` Richard Henderson
2015-09-18 12:45                             ` Richard Biener
2015-09-18 13:55                               ` Ilya Enkovich
2015-08-25 21:42       ` [Scalar masks 2/x] Use bool masks in if-conversion Jeff Law
2015-08-26 11:14         ` Ilya Enkovich
2015-08-26 13:12           ` Richard Biener
2015-08-26 16:58           ` Jeff Law
2015-08-21 15:57     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMbmDYZGQ0Znz0e01+wLT+-uaAno1Shq9D08eBoDKNxLoUjB8Q@mail.gmail.com \
    --to=enkovich.gnu@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).