public inbox for
 help / color / mirror / Atom feed
From: Juzhe-Zhong <>
	Juzhe-Zhong <>
Subject: [PATCH] RISC-V: Fix VL operand bug in VSETVL PASS[PR110264]
Date: Fri, 16 Jun 2023 16:02:31 +0800	[thread overview]
Message-ID: <> (raw)

This patch fixes this issue happens on both GCC-13 and GCC-14.

The testcase is too big and I failed to reduce it so I didn't append
test into this patch.

This patch should not only land into GCC-14 but also should backport to GCC-13.

	PR target/110264


        * config/riscv/ (insert_vsetvl): Fix bug.

 gcc/config/riscv/ | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/ b/gcc/config/riscv/
index cae9be0d928..42cc6f29f26 100644
--- a/gcc/config/riscv/
+++ b/gcc/config/riscv/
@@ -744,7 +744,10 @@ insert_vsetvl (enum emit_type emit_type, rtx_insn *rinsn,
   if (vlmax_avl_p (info.get_avl ()))
       gcc_assert (has_vtype_op (rinsn) || vsetvl_insn_p (rinsn));
-      rtx vl_op = info.get_avl_reg_rtx ();
+      /* For user vsetvli a5, zero, we should use get_vl to get the VL
+	 operand "a5".  */
+      rtx vl_op
+	= vsetvl_insn_p (rinsn) ? get_vl (rinsn) : info.get_avl_reg_rtx ();
       gcc_assert (!vlmax_avl_p (vl_op));
       emit_vsetvl_insn (VSETVL_NORMAL, emit_type, info, vl_op, rinsn);
       return VSETVL_NORMAL;

             reply	other threads:[~2023-06-16  8:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  8:02 Juzhe-Zhong [this message]
2023-06-16 15:53 ` Jeff Law
2023-06-16 23:38   ` Li, Pan2

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* 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).