public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
@ 2023-12-20  8:39 Wang Pengcheng
  2023-12-20 17:08 ` Jeff Law
  2023-12-20 17:36 ` Jeff Law
  0 siblings, 2 replies; 5+ messages in thread
From: Wang Pengcheng @ 2023-12-20  8:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: wangpc

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

From: wangpc

The condition is RISCV_FUSE_ZEXTH, which is a mistake.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix condition.
---
gcc/config/riscv/riscv.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 8ae65760b6e..87a62119b01 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -8089,7 +8089,7 @@ riscv_macro_fusion_pair_p (rtx_insn *prev, rtx_insn
*curr)
return false;

if (simple_sets_p && (riscv_fusion_enabled_p (RISCV_FUSE_ZEXTW) ||
- riscv_fusion_enabled_p (RISCV_FUSE_ZEXTH)))
+ riscv_fusion_enabled_p (RISCV_FUSE_ZEXTWS)))
{
/* We are trying to match the following:
prev (slli) == (set (reg:DI rD)
-- 
2.20.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
  2023-12-20  8:39 [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition Wang Pengcheng
@ 2023-12-20 17:08 ` Jeff Law
  2023-12-21  3:30   ` [External] " Wang Pengcheng
  2023-12-20 17:36 ` Jeff Law
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Law @ 2023-12-20 17:08 UTC (permalink / raw)
  To: Wang Pengcheng, gcc-patches



On 12/20/23 01:39, Wang Pengcheng wrote:
> From: wangpc
> 
> The condition is RISCV_FUSE_ZEXTH, which is a mistake.
> 
> gcc/ChangeLog:
> 
> * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix condition.
Thanks!  As soon as this patch finishes regression testing I'll push it 
to the trunk.

I'm curious, how did you find this?  Did you see a case where fusible 
ops weren't being kept together or did you find it just by code examination?

Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
  2023-12-20  8:39 [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition Wang Pengcheng
  2023-12-20 17:08 ` Jeff Law
@ 2023-12-20 17:36 ` Jeff Law
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Law @ 2023-12-20 17:36 UTC (permalink / raw)
  To: Wang Pengcheng, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]



On 12/20/23 01:39, Wang Pengcheng wrote:
> The condition is RISCV_FUSE_ZEXTH, which is a mistake.
> 
> gcc/ChangeLog:
> 
> * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix condition.
I've pushed this to the trunk.  Attached is the actual patch committed 
which also fixes formatting of that code.

Thanks again!
jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1017 bytes --]

commit eef65d60a8bb2e9328fd9d2b6cd869618be4f08e
Author: Wang Pengcheng <wangpengcheng.pp@bytedance.com>
Date:   Wed Dec 20 10:32:59 2023 -0700

    [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
    
    The condition is RISCV_FUSE_ZEXTH, which is a mistake.
    
    gcc/ChangeLog:
    
            * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix condition.

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index d9b45f17a1b..c6784a22127 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -8096,8 +8096,9 @@ riscv_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
   if (!riscv_macro_fusion_p ())
     return false;
 
-  if (simple_sets_p && (riscv_fusion_enabled_p (RISCV_FUSE_ZEXTW) ||
-			riscv_fusion_enabled_p (RISCV_FUSE_ZEXTH)))
+  if (simple_sets_p
+      && (riscv_fusion_enabled_p (RISCV_FUSE_ZEXTW)
+	  || riscv_fusion_enabled_p (RISCV_FUSE_ZEXTWS)))
     {
       /* We are trying to match the following:
 	   prev (slli) == (set (reg:DI rD)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [External] Re: [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
  2023-12-20 17:08 ` Jeff Law
@ 2023-12-21  3:30   ` Wang Pengcheng
  2023-12-21  4:07     ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Pengcheng @ 2023-12-21  3:30 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On 2023/12/21 1:08, Jeff Law wrote:
>
>
> On 12/20/23 01:39, Wang Pengcheng wrote:
>> From: wangpc
>>
>> The condition is RISCV_FUSE_ZEXTH, which is a mistake.
>>
>> gcc/ChangeLog:
>>
>> * config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Fix condition.
> Thanks!  As soon as this patch finishes regression testing I'll push
> it to the trunk.
>
> I'm curious, how did you find this?  Did you see a case where fusible
> ops weren't being kept together or did you find it just by code
> examination?
>
> Jeff

Yeah, I just found it when I tried to understand the original fusion
implementation commit. :-)

And thanks a lot for formatting and merging the patch! I'm sorry that I
almost forgot the process of contribution to GCC as the last time I did
it is about two years ago.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [External] Re: [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition
  2023-12-21  3:30   ` [External] " Wang Pengcheng
@ 2023-12-21  4:07     ` Jeff Law
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Law @ 2023-12-21  4:07 UTC (permalink / raw)
  To: Wang Pengcheng, gcc-patches



On 12/20/23 20:30, Wang Pengcheng wrote:

> 
> Yeah, I just found it when I tried to understand the original fusion
> implementation commit. :-)
Ah.  If you have any questions, don't hesitate to reach out.  While I 
didn't do the original implementation (that was Philipp T. and his 
team), the basics are pretty straightforward and my team has made some 
minor additions to the cases supported.

> 
> And thanks a lot for formatting and merging the patch! I'm sorry that I
> almost forgot the process of contribution to GCC as the last time I did
> it is about two years ago.
No problem.  The goofy formatting slipped through my review when I 
pushed Philipp's code a little while ago.  Figured there wasn't enough 
changing here to warrant a distinct patch for the formatting fix.

Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-21  4:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  8:39 [PATCH] RISC-V: Fix RISCV_FUSE_ZEXTWS fusion condition Wang Pengcheng
2023-12-20 17:08 ` Jeff Law
2023-12-21  3:30   ` [External] " Wang Pengcheng
2023-12-21  4:07     ` Jeff Law
2023-12-20 17:36 ` Jeff Law

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