Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-05 Thread Kito Cheng via Gcc-patches
zh...@rivai.ai; Wang, Yanzhang > > Subject: Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET > > I will take V1 and commit to trunk after my local test is done :) > > On Fri, May 5, 2023 at 8:30 PM Li, Pan2 wrote: > > > > Hi kito, > > > >

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-05 Thread Li, Pan2 via Gcc-patches
Ok, sounds good. Thank you! Pan -Original Message- From: Kito Cheng Sent: Friday, May 5, 2023 8:37 PM To: Li, Pan2 Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; Wang, Yanzhang Subject: Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET I will take V1 and

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-05 Thread Kito Cheng via Gcc-patches
From: Li, Pan2 > Sent: Wednesday, May 3, 2023 7:18 PM > To: Jeff Law ; Kito Cheng > Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; Wang, Yanzhang > ; Andrew Waterman > Subject: RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET > > Thanks all for co

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-05 Thread Li, Pan2 via Gcc-patches
Subject: RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET Thanks all for comments, will work with kito to make it happen. Pan -Original Message- From: Jeff Law Sent: Wednesday, May 3, 2023 12:28 AM To: Kito Cheng Cc: Li, Pan2 ; gcc-patches@gcc.gnu.org; juzhe.zh

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-03 Thread Li, Pan2 via Gcc-patches
: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET On 4/29/23 19:40, Kito Cheng wrote: > Hi Jeff: > > The RTL pattern already models tail element and vector length well, so > I don't feel the first version of Pan's patch has any problem? > > Input RTL pattern: > >

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-05-02 Thread Jeff Law via Gcc-patches
On 4/29/23 19:40, Kito Cheng wrote: Hi Jeff: The RTL pattern already models tail element and vector length well, so I don't feel the first version of Pan's patch has any problem? Input RTL pattern: #(insn 10 7 12 2 (set (reg:VNx2BI 134 [ _1 ]) #(if_then_else:VNx2BI (unspec:VNx2BI [

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-30 Thread Li, Pan2 via Gcc-patches
policy and vector length as well. Pan -Original Message- From: Kito Cheng Sent: Sunday, April 30, 2023 9:40 AM To: Jeff Law Cc: Li, Pan2 ; gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; Wang, Yanzhang ; Andrew Waterman Subject: Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) s

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Kito Cheng via Gcc-patches
Hi Jeff: The RTL pattern already models tail element and vector length well, so I don't feel the first version of Pan's patch has any problem? Input RTL pattern: #(insn 10 7 12 2 (set (reg:VNx2BI 134 [ _1 ]) #(if_then_else:VNx2BI (unspec:VNx2BI [ #(const_vector:VNx2BI

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Palmer Dabbelt
On Sat, 29 Apr 2023 10:52:50 PDT (-0700), jeffreya...@gmail.com wrote: On 4/29/23 11:48, Palmer Dabbelt wrote: Yea.  And taking advantage of that behavior is definitely a performance issue for QEMU.  There's still work to do though.  QEMU on vector code is running crazy slow. I guess we're

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Jeff Law via Gcc-patches
On 4/29/23 11:48, Palmer Dabbelt wrote: Yea.  And taking advantage of that behavior is definitely a performance issue for QEMU.  There's still work to do though.  QEMU on vector code is running crazy slow. I guess we're kind of off the rails for a GCC patch, but that's definately true.  Ac

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Jeff Law via Gcc-patches
On 4/29/23 11:21, Andrew Waterman wrote: The relevant statement in the spec is that "the tail elements are always updated with a tail-agnostic policy".  The vmset.m instruction will cause mask register bits [0, vl-1] to be set to 1; elements [vl, VLMAX-1] will either be undisturbed or set

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Palmer Dabbelt
On Sat, 29 Apr 2023 10:46:37 PDT (-0700), jeffreya...@gmail.com wrote: On 4/29/23 11:28, Palmer Dabbelt wrote: On Sat, 29 Apr 2023 10:21:53 PDT (-0700), gcc-patches@gcc.gnu.org wrote: On Sat, Apr 29, 2023 at 8:06 AM Jeff Law via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: On 4/28/23 20:

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Jeff Law via Gcc-patches
On 4/29/23 11:28, Palmer Dabbelt wrote: On Sat, 29 Apr 2023 10:21:53 PDT (-0700), gcc-patches@gcc.gnu.org wrote: On Sat, Apr 29, 2023 at 8:06 AM Jeff Law via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: On 4/28/23 20:55, Li, Pan2 wrote: > Thanks Jeff for comments. > > It makes sense to m

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Palmer Dabbelt
On Sat, 29 Apr 2023 10:21:53 PDT (-0700), gcc-patches@gcc.gnu.org wrote: On Sat, Apr 29, 2023 at 8:06 AM Jeff Law via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: On 4/28/23 20:55, Li, Pan2 wrote: > Thanks Jeff for comments. > > It makes sense to me. For the EQ operator we should have CONSTM

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Andrew Waterman via Gcc-patches
On Sat, Apr 29, 2023 at 8:06 AM Jeff Law via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: > > > > On 4/28/23 20:55, Li, Pan2 wrote: > > Thanks Jeff for comments. > > > > It makes sense to me. For the EQ operator we should have CONSTM1. > That's not the way I interpret the RVV documentation. Of co

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Jeff Law via Gcc-patches
On 4/28/23 20:55, Li, Pan2 wrote: Thanks Jeff for comments. It makes sense to me. For the EQ operator we should have CONSTM1. That's not the way I interpret the RVV documentation. Of course it's not terribly clear.I guess one could do some experiments with qemu or try to dig into the

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-29 Thread Li, Pan2 via Gcc-patches
, 2023 10:55 AM To: Jeff Law ; gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Wang, Yanzhang Subject: RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET Thanks Jeff for comments. It makes sense to me. For the EQ operator we should have CONSTM1. Does this

RE: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-28 Thread Li, Pan2 via Gcc-patches
-Original Message- From: Jeff Law Sent: Saturday, April 29, 2023 5:48 AM To: Li, Pan2 ; gcc-patches@gcc.gnu.org Cc: juzhe.zh...@rivai.ai; kito.ch...@sifive.com; Wang, Yanzhang Subject: Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET On 4/28/23 09:21, Pan Li via Gcc

Re: [PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-28 Thread Jeff Law via Gcc-patches
On 4/28/23 09:21, Pan Li via Gcc-patches wrote: From: Pan Li When some RVV integer compare operators act on the same vector registers without mask. They can be simplified to VMSET. This PATCH allows the eq, le, leu, ge, geu to perform such kind of the simplification by adding one macro in r

[PATCH] RISC-V: Allow RVV VMS{Compare}(V1, V1) simplify to VMSET

2023-04-28 Thread Pan Li via Gcc-patches
From: Pan Li When some RVV integer compare operators act on the same vector registers without mask. They can be simplified to VMSET. This PATCH allows the eq, le, leu, ge, geu to perform such kind of the simplification by adding one macro in riscv for simplify rtx. Given we have: vbool1_t test_