public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lehua Ding <lehua.ding@rivai.ai>
To: Kito Cheng <kito.cheng@gmail.com>,
	"juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] RISC-V: Fix vsetvl pass ICE
Date: Thu, 31 Aug 2023 10:12:45 +0800	[thread overview]
Message-ID: <6AEFDC73A08F2055+28556a8d-3c5e-4601-80be-69b1f42ff31e@rivai.ai> (raw)
In-Reply-To: <CA+yXCZCSXj-UsEvta2i-TEWprtprYZjOphp9jQP6vmNu9LM3gw@mail.gmail.com>

Committed to the trunk and backported to GCC 13 one week later.
Thanks Juzhe and Kito.

On 2023/8/31 9:44, Kito Cheng via Gcc-patches wrote:
> OK for gcc 13 branch too, the general rule for backport is to wait one
> week on trunk to make sure the fix is stable.
> 
> 
> On Thu, Aug 31, 2023 at 8:08 AM juzhe.zhong@rivai.ai
> <juzhe.zhong@rivai.ai> wrote:
>>
>> Ok for trunk. But not sure whether it's ok for GCC-13.
>>
>>
>>
>> juzhe.zhong@rivai.ai
>>
>> From: Lehua Ding
>> Date: 2023-08-30 17:51
>> To: gcc-patches
>> CC: juzhe.zhong; kito.cheng; rdapp.gcc; palmer; jeffreyalaw
>> Subject: [PATCH] RISC-V: Fix vsetvl pass ICE
>> This patch fix pr111234 (a vsetvl pass ICE) when fuse a mask any
>> vlmax vsetvl_vtype_change_only insn with a mu vsetvl insn.
>>
>> PR target/111234
>>
>> gcc/ChangeLog:
>>
>> * config/riscv/riscv-vsetvl.cc (gen_vsetvl_pat): Remove condition.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/riscv/rvv/vsetvl/pr111234.c: New test.
>>
>> ---
>> gcc/config/riscv/riscv-vsetvl.cc              |  2 +-
>> .../gcc.target/riscv/rvv/vsetvl/pr111234.c    | 19 +++++++++++++++++++
>> 2 files changed, 20 insertions(+), 1 deletion(-)
>> create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c
>>
>> diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
>> index 1386d9250ca..a81bb53a521 100644
>> --- a/gcc/config/riscv/riscv-vsetvl.cc
>> +++ b/gcc/config/riscv/riscv-vsetvl.cc
>> @@ -655,7 +655,7 @@ gen_vsetvl_pat (rtx_insn *rinsn, const vector_insn_info &info,
>>       new_pat = gen_vsetvl_pat (VSETVL_NORMAL, new_info, vl);
>>     else
>>       {
>> -      if (vsetvl_insn_p (rinsn) || vlmax_avl_p (info.get_avl ()))
>> +      if (vsetvl_insn_p (rinsn))
>> new_pat = gen_vsetvl_pat (VSETVL_NORMAL, new_info, get_vl (rinsn));
>>         else if (INSN_CODE (rinsn) == CODE_FOR_vsetvl_vtype_change_only)
>> new_pat = gen_vsetvl_pat (VSETVL_VTYPE_CHANGE_ONLY, new_info, NULL_RTX);
>> diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c
>> new file mode 100644
>> index 00000000000..ee5eec4a257
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c
>> @@ -0,0 +1,19 @@
>> +/* { dg-do compile } */
>> +/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
>> +
>> +#include <riscv_vector.h>
>> +
>> +void
>> +f (vint32m1_t *in, vint64m2_t *out, vbool32_t *m, int b)
>> +{
>> +  vint32m1_t va = *in;
>> +  vbool32_t mask = *m;
>> +  vint64m2_t vb
>> +    = __riscv_vwadd_vx_i64m2_m (mask, va, 1, __riscv_vsetvlmax_e64m2 ());
>> +  vint64m2_t vc = __riscv_vadd_vx_i64m2 (vb, 1, __riscv_vsetvlmax_e64m2 ());
>> +
>> +  if (b != 0)
>> +    vc = __riscv_vadd_vx_i64m2_mu (mask, vc, vc, 1, __riscv_vsetvlmax_e64m2 ());
>> +
>> +  *out = vc;
>> +}
>> --
>> 2.36.3
>>

-- 
Best,
Lehua


  reply	other threads:[~2023-08-31  2:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30  9:51 Lehua Ding
2023-08-31  0:07 ` juzhe.zhong
2023-08-31  1:44   ` Kito Cheng
2023-08-31  2:12     ` Lehua Ding [this message]
2023-09-18  7:54       ` Lehua Ding
2023-09-18  8:08         ` Kito Cheng
2023-09-18  8:22           ` Lehua Ding

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=6AEFDC73A08F2055+28556a8d-3c5e-4601-80be-69b1f42ff31e@rivai.ai \
    --to=lehua.ding@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.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).