public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: juzhe.zhong@rivai.ai
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, rguenther@suse.de,
	richard.sandiford@arm.com, zhongjuzhe <juzhe.zhong@rivai.ai>
Subject: [PATCH]   middle-end: skipp stepped vector test of poly_int (1, 1) and allow the machine_mode definition with poly_uint16 (1, 1)
Date: Thu, 18 Aug 2022 18:46:08 +0800	[thread overview]
Message-ID: <20220818104608.259204-1-juzhe.zhong@rivai.ai> (raw)

From: zhongjuzhe <juzhe.zhong@rivai.ai>

Hello. This patch is preparing for following RVV support.

Both ARM SVE and RVV (RISC-V 'V' Extension) support length-agnostic vector.
The minimum vector length of ARM SVE is 128-bit and the runtime invariant of ARM SVE is always 128-bit blocks.
However, the minimum vector length of RVV can be 32bit in 'Zve32*' sub-extension and 64bit in 'Zve*' sub-extension.

So I define the machine_mode as follows:
VECTOR_MODE_WITH_PREFIX (VNx, INT, DI, 1, 0);
ADJUST_NUNITS (MODE, riscv_vector_chunks);
The riscv_vector_chunks = poly_uint16 (1, 1)

The compilation is failed for the stepped vector test:
(const_vector:VNx1DI repeat [
        (const_int 8 [0x8])
        (const_int 7 [0x7])
    ])

I understand for stepped vector should always have aleast 2 elements and stepped vector initialization is common
for VLA (vector-lengthe agnostic) auto-vectorization. It makes sense that report fail for stepped vector of poly_uint16 (1, 1).

machine mode with nunits = poly_uint16 (1, 1) needs to implemented in intrinsics. And I would like to enable RVV auto-vectorization
with vector mode only nunits is larger than poly_uint16 (2, 2) in RISC-V backend. I think it will not create issue if we define
vector mode with nunits = poly_uint16 (1, 1). Feel free to correct me or offer me some other better solutions. Thanks!

  

gcc/ChangeLog:

        * simplify-rtx.cc (test_vector_subregs_fore_back): skip test for poly_uint16 (1, 1).

---
 gcc/simplify-rtx.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 7d09bf7103d..61e0dfa00d0 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -8438,7 +8438,7 @@ test_vector_subregs_fore_back (machine_mode inner_mode)
   rtx x = builder.build ();
 
   test_vector_subregs_modes (x);
-  if (!nunits.is_constant ())
+  if (!nunits.is_constant () && known_ne (nunits, poly_uint16 (1, 1)))
     test_vector_subregs_modes (x, nunits - min_nunits, count);
 }
 
-- 
2.36.1


             reply	other threads:[~2022-08-18 10:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 10:46 juzhe.zhong [this message]
2022-08-19  8:03 ` Richard Sandiford
2022-08-19  8:19   ` juzhe.zhong
2022-08-19  9:06   ` juzhe.zhong
2022-08-19  9:35     ` Richard Sandiford
2022-08-19  9:57       ` juzhe.zhong
2022-08-19 12:52         ` Richard Sandiford
2022-08-19 14:10           ` 钟居哲
2022-08-19 14:34           ` 钟居哲
2022-08-20  1:23           ` 钟居哲
2022-08-22  8:31             ` Richard Sandiford
2022-08-22  8:45               ` juzhe.zhong
2022-08-22  8:56                 ` Richard Sandiford
2022-08-22  9:12                   ` juzhe.zhong

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=20220818104608.259204-1-juzhe.zhong@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=rguenther@suse.de \
    --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).