public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kevin Lee <kevinl@rivosinc.com>
To: gcc-patches@gcc.gnu.org
Cc: Kevin Lee <kevinl@rivosinc.com>
Subject: [PATCH v3] vect: Verify that GET_MODE_UNITS is greater than one for vect_grouped_store_supported
Date: Mon, 17 Apr 2023 09:38:56 -0700	[thread overview]
Message-ID: <20230417163856.2253309-1-kevinl@rivosinc.com> (raw)
In-Reply-To: <CALkvSf_bvuaFZG63kNQMTGvFx+ki6ih1h56=uUuVxP0hcL8_ow@mail.gmail.com>

This patch properly guards gcc_assert (multiple_p (m_full_nelts, 
m_npatterns)) in vec_perm_indices indices (sel, 2, nelt) for VNx1 vectors.

Based on the feedback from Richard Biener and Richard Sandiford,
multiple_p has been used instead of maybe_lt to compare nelt with the
minimum size 2.

Bootstrap and testing done on x86_64-pc-linux-gnu. Would this be ok for trunk?

Patch V1: https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614463.html
Patch V2: https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614700.html
 
Kevin Lee <kevinl@rivosinc.com>
gcc/ChangeLog:

	* tree-vect-data-refs.cc (vect_grouped_store_supported): Add new
condition
---
 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..df393ba723d 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(!multiple_p (nelt, 2))
+      return false;
 	  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-17 16:39 UTC|newest]

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