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: collison@rivosinc.com, Kevin Lee <kevinl@rivosinc.com>
Subject: [PATCH v2][RFC] vect: Verify that GET_MODE_NUNITS is greater than one for vect_grouped_store_supported
Date: Mon, 27 Mar 2023 09:01:57 -0700	[thread overview]
Message-ID: <20230327160157.4111747-1-kevinl@rivosinc.com> (raw)

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


             reply	other threads:[~2023-03-27 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 16:01 Kevin Lee [this message]
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       ` [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=20230327160157.4111747-1-kevinl@rivosinc.com \
    --to=kevinl@rivosinc.com \
    --cc=collison@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).