public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pan Li <panli@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-5592] RISC-V: Fix bug of tuple move splitter
Date: Sun, 19 Nov 2023 02:44:33 +0000 (GMT)	[thread overview]
Message-ID: <20231119024433.82E9D3858D32@sourceware.org> (raw)

https://gcc.gnu.org/g:af7fa3135b6b046fe3ba869993221042a65301eb

commit r14-5592-gaf7fa3135b6b046fe3ba869993221042a65301eb
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Sun Nov 19 09:45:33 2023 +0800

    RISC-V: Fix bug of tuple move splitter
    
    PR target/112561
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-v.cc (expand_tuple_move): Fix bug.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/rvv/autovec/pr112561.c: New test.

Diff:
---
 gcc/config/riscv/riscv-v.cc                           |  4 ++++
 gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c | 16 ++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index c718b504618..291f3c75282 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -2033,6 +2033,10 @@ expand_tuple_move (rtx *ops)
 	  offset = ops[2];
 	}
 
+      /* Non-fractional LMUL has whole register moves that don't require a
+	 vsetvl for VLMAX.  */
+      if (fractional_p)
+	emit_vlmax_vsetvl (subpart_mode, ops[4]);
       if (MEM_P (ops[1]))
 	{
 	  /* Load operations.  */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c
new file mode 100644
index 00000000000..25e61fa12c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-options "-O3 -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -mcmodel=medlow" } */
+
+int printf(char *, ...);
+int a, b, c, e;
+short d[7][7] = {};
+int main() {
+  short f;
+  c = 0;
+  for (; c <= 6; c++) {
+    e |= d[c][c] & 1;
+    b &= f & 3;
+  }
+  printf("%d\n", a);
+  return 0;
+}

                 reply	other threads:[~2023-11-19  2:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231119024433.82E9D3858D32@sourceware.org \
    --to=panli@gcc.gnu.org \
    --cc=gcc-cvs@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).