public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
		Richard Sandiford <richard.sandiford@linaro.org>
Subject: Re: [00/13] Make VEC_PERM_EXPR work for variable-length vectors
Date: Tue, 12 Dec 2017 15:38:00 -0000	[thread overview]
Message-ID: <CAFiYyc3S=2Sb8nBXTagxkEbo_1YxTquHti42GbM00nN1c=0_Kg@mail.gmail.com> (raw)
In-Reply-To: <87k1xsq7wq.fsf@linaro.org>

On Tue, Dec 12, 2017 at 4:32 PM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> Richard Biener <richard.guenther@gmail.com> writes:
>> On Sun, Dec 10, 2017 at 12:06 AM, Richard Sandiford
>> <richard.sandiford@linaro.org> wrote:
>>> This series is a replacement for:
>>> https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00747.html
>>> based on the feedback that using VEC_PERM_EXPR would be better.
>>>
>>> The changes are:
>>>
>>> (1) Remove the restriction that the selector elements have to have the
>>>     same width as the data elements, but only for constant selectors.
>>>     This lets through the cases we need without also allowing
>>>     potentially-expensive ops.  Adding support for the variable
>>>     case can be done later if it seems useful, but it's not trivial.
>>>
>>> (2) Encode the integer form of constant selectors (vec_perm_indices)
>>>     in the same way as the new VECTOR_CST encoding, so that it can
>>>     cope with variable-length vectors.
>>>
>>> (3) Remove the vec_perm_const optab and reuse the target hook to emit
>>>     code.  This avoids the need to create a CONST_VECTOR for the wide
>>>     selectors, and hence the need to have a corresponding wide vector
>>>     mode (which the target wouldn't otherwise need or support).
>>
>> Hmm.  Makes sense I suppose.
>>
>>> (4) When handling the variable vec_perm optab, check that modes can store
>>>     all element indices before using them.
>>>
>>> (5) Unconditionally use ssizetype selector elements in permutes created
>>>     by the vectoriser.
>>
>> Why specifically _signed_ sizetype?  That sounds like an odd choice.  But I'll
>> eventually see when looking at the patch.
>
> Sorry, should have said.  The choice doesn't matter for vector lengths
> that are a power of 2,

which are the only ones we support anyway?

> but for others, using a signed selector means that
> -1 always selects the last input element, whereas for unsigned selectors,
> the element selected by -1 would depend on the selector precision.  (And the
> use of sizetype precision is pretty arbitrary.)

hmm, so you are saying that vec_perm <v1, v2, { -1, -2, ... }> is equal
to vec_perm <v1, v2, {2*n-1, 2*n-2, ....}?

tree.def defines VEC_PERM_EXPR via

   N = length(mask)
   foreach i in N:
     M = mask[i] % (2*N)
     A = M < N ? v0[M] : v1[M-N]

which doesn't reflect this behavior.  Does this behavior persist for variable
vector permutations?

>
>> Does that mean we have a VNDImode vector unconditionally for the
>> permute even though a vector matching the width of the data members
>> would work?
>
> A VECTOR_CST of N DIs, yeah.  It only becomes a VNDI at the rtl level
> if we're selecting 64-bit data elements.

And on GIMPLE?  Do we have a vector type with ssizetype elements
unconditionally?

>> What happens if the target doesn't have vec_perm_const but vec_perm to
>> handle all constant permutes?
>
> We'll try to represent the selector as VN?I, where ? matches the width
> of the data, but only after checking that that doesn't change the
> selector values.  So for current targets we'll use vec_perm for constant
> permutes as before, but we wouldn't for 2-input V256QI interleaves.

I see.

Richard.

> Thanks,
> Richard

  reply	other threads:[~2017-12-12 15:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09 23:06 Richard Sandiford
2017-12-09 23:08 ` [01/13] Add a qimode_for_vec_perm helper function Richard Sandiford
2017-12-18 13:34   ` Richard Biener
2017-12-09 23:09 ` [02/13] Pass vec_perm_indices by reference Richard Sandiford
2017-12-12 14:23   ` Richard Biener
2017-12-09 23:11 ` [03/13] Split can_vec_perm_p into can_vec_perm_{var,const}_p Richard Sandiford
2017-12-12 14:25   ` Richard Biener
2017-12-09 23:13 ` [04/13] Refactor expand_vec_perm Richard Sandiford
2017-12-12 15:17   ` Richard Biener
2017-12-09 23:17 ` [05/13] Remove vec_perm_const optab Richard Sandiford
2017-12-12 15:26   ` Richard Biener
2017-12-20 13:42     ` Richard Sandiford
2017-12-09 23:18 ` [06/13] Check whether a vector of QIs can store all indices Richard Sandiford
2017-12-12 15:27   ` Richard Biener
2017-12-09 23:20 ` [07/13] Make vec_perm_indices use new vector encoding Richard Sandiford
2017-12-12 15:32   ` Richard Biener
2017-12-12 15:47     ` Richard Sandiford
2017-12-14 10:37       ` Richard Biener
2017-12-20 13:48         ` Richard Sandiford
2018-01-02 13:15           ` Richard Biener
2018-01-02 18:30             ` Richard Sandiford
2017-12-09 23:20 ` [08/13] Add a vec_perm_indices_to_tree helper function Richard Sandiford
2017-12-18 13:34   ` Richard Biener
2017-12-09 23:21 ` [09/13] Use explicit encodings for simple permutes Richard Sandiford
2017-12-19 20:37   ` Richard Sandiford
2018-01-02 13:07   ` Richard Biener
2017-12-09 23:23 ` [10/13] Rework VEC_PERM_EXPR folding Richard Sandiford
2017-12-09 23:24   ` [11/13] Use vec_perm_builder::series_p in shift_amt_for_vec_perm_mask Richard Sandiford
2017-12-19 20:37     ` Richard Sandiford
2018-01-02 13:08     ` Richard Biener
2017-12-09 23:25   ` [12/13] Use ssizetype selectors for autovectorised VEC_PERM_EXPRs Richard Sandiford
2017-12-19 20:37     ` Richard Sandiford
2018-01-02 13:09     ` Richard Biener
2017-12-19 20:37   ` [10/13] Rework VEC_PERM_EXPR folding Richard Sandiford
2018-01-02 13:08   ` Richard Biener
2017-12-09 23:27 ` [13/13] [AArch64] Use vec_perm_indices helper routines Richard Sandiford
2017-12-19 20:37   ` Richard Sandiford
2018-01-04 11:28     ` Richard Sandiford
2018-01-09 12:18       ` James Greenhalgh
2018-01-09 16:24         ` RFA: Expand vec_perm_indices::series_p comment Richard Sandiford
2018-01-29 20:56           ` Ping: " Richard Sandiford
2018-01-30  7:20             ` Jeff Law
2017-12-12 14:12 ` [00/13] Make VEC_PERM_EXPR work for variable-length vectors Richard Biener
2017-12-12 15:32   ` Richard Sandiford
2017-12-12 15:38     ` Richard Biener [this message]
2017-12-12 15:57       ` Richard Sandiford

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='CAFiYyc3S=2Sb8nBXTagxkEbo_1YxTquHti42GbM00nN1c=0_Kg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@linaro.org \
    /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).