public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Kevin Lee <kevinl@rivosinc.com>,
	Richard Sandiford <richard.sandiford@arm.com>
Cc: gcc-patches@gcc.gnu.org, collison@rivosinc.com
Subject: Re: [PATCH v2][RFC] vect: Verify that GET_MODE_NUNITS is greater than one for vect_grouped_store_supported
Date: Tue, 11 Apr 2023 11:32:50 +0200	[thread overview]
Message-ID: <CAFiYyc2x34paDzxSZmoNZQRbUNvg+vRdn5ORgT7fRs9_8u7k0Q@mail.gmail.com> (raw)
In-Reply-To: <20230327160157.4111747-1-kevinl@rivosinc.com>

On Mon, Mar 27, 2023 at 6:02 PM Kevin Lee <kevinl@rivosinc.com> wrote:
>
> This patch is a proper fix to the previous patch
> https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614463.html
> vect_grouped_store_supported checks if the count is a power of 2, but
> doesn't check the size of the GET_MODE_NUNITS.
> This should handle the riscv case where the mode is VNx1DI since the
> nelt would be {1, 1}.
> It was tested on RISCV and x86_64-linux-gnu. Would this be correct
> for the vectors with size smaller than 2?
>
> ---
>  gcc/tree-vect-data-refs.cc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
> index 8daf7bd7dd3..04ad12f7d04 100644
> --- a/gcc/tree-vect-data-refs.cc
> +++ b/gcc/tree-vect-data-refs.cc
> @@ -5399,6 +5399,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
>           poly_uint64 nelt = GET_MODE_NUNITS (mode);
>
>           /* The encoding has 2 interleaved stepped patterns.  */
> +    if(!nelt.is_constant() && maybe_lt(nelt, (unsigned int) 2))
> +      return false;

Indentation is off (or your MUA is broken).  I think the nelt.is_constant ()
check is superfluous but with constant nelt we'd never end up with a
grouped store.

Note the calls are guarded with

         && ! known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)

maybe the better fix is to change those to ! maybe_eq?

Richard should know best here.

Richard.

>           vec_perm_builder sel (nelt, 2, 3);
>           sel.quick_grow (6);
>           for (i = 0; i < 3; i++)
> --
> 2.25.1
>

  reply	other threads:[~2023-04-11  9:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 16:01 Kevin Lee
2023-04-11  9:32 ` Richard Biener [this message]
2023-04-11 10:05   ` Richard Sandiford
2023-04-12 15:11     ` Kevin Lee
2023-04-17 16:38       ` [PATCH v3] vect: Verify that GET_MODE_UNITS " Kevin Lee
2023-04-18  6:08         ` Richard Biener
2023-04-18 18:43         ` 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=CAFiYyc2x34paDzxSZmoNZQRbUNvg+vRdn5ORgT7fRs9_8u7k0Q@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=collison@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kevinl@rivosinc.com \
    --cc=richard.sandiford@arm.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).