From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 8E9D5385842C; Mon, 19 Jun 2023 11:41:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E9D5385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687174916; bh=bdLe/Sw9hYmllLAdlYaN6cNeoe/PhaHwEZ5N8Ugl3AE=; h=From:To:Subject:Date:From; b=EFYWBg/FIh2O8uFent+L9Z5VjNwbMO9wMUu1/2snUK4CDUc1+A7Uu/gXM2Qg/AsBB UQv9xvyr9tJ6T3n6BCsS8B76AE0bH+/TjfhfkiwBhwCAWn6leIbhDPz9T0dxa7ItVf wgdumPLjeh2a3O4wnbQmmeO6gjgIXV8A6vKcjdR4= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix VL operand bug in VSETVL PASS[PR110264] X-Act-Checkin: gcc X-Git-Author: Juzhe-Zhong X-Git-Refname: refs/vendors/riscv/heads/gcc-13-with-riscv-opts X-Git-Oldrev: 63e7c34efd4e50b1f256e2c0ad1220abfba92b78 X-Git-Newrev: 2b227a449d5915b5af6c77fce08b430637c59e54 Message-Id: <20230619114156.8E9D5385842C@sourceware.org> Date: Mon, 19 Jun 2023 11:41:56 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2b227a449d5915b5af6c77fce08b430637c59e54 commit 2b227a449d5915b5af6c77fce08b430637c59e54 Author: Juzhe-Zhong Date: Fri Jun 16 16:02:31 2023 +0800 RISC-V: Fix VL operand bug in VSETVL PASS[PR110264] This patch fixes this issue happens on both GCC-13 and GCC-14. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110264 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 gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (insert_vsetvl): Fix bug. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 7066dea3d14..971c3f90742 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -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;