public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Fei Gao" <gaofei@eswincomputing.com>
To: "Kito Cheng" <kito.cheng@gmail.com>,
	 "Andrew Pinski" <pinskia@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	 "Palmer Dabbelt" <palmer@dabbelt.com>,
	 jeffreyalaw <jeffreyalaw@gmail.com>,
	 Sinan <sinan.lin@linux.alibaba.com>,
	 jiawei <jiawei@iscas.ac.cn>,
	 liaozhangjin <liaozhangjin@eswincomputing.com>
Subject: Re: Re: [PATCH 1/2] [RISC-V] disable shrink-wrap-separate if zcmp enabled.
Date: Wed, 10 May 2023 17:33:16 +0800	[thread overview]
Message-ID: <20230510173316379068161@eswincomputing.com> (raw)
In-Reply-To: <CA+yXCZB9oEriiWdoXv2rk5oRJf8UkqXKwz3dTtO=Fb2cJM4x1A@mail.gmail.com>

On 2023-05-08 17:20  Kito Cheng <kito.cheng@gmail.com> wrote:
>
>-msave-restore is a different story; it's only enabled when the user
>requests, but `-march` describes the capability of the target
>architecture, not specify the preference of performance or size, which
>should be determined by -O1~-O3/-Ofast or -Os/-Oz.
> 

I see and fully agree. 
I'll find a better way to resolve the conflict, 
My current idea is to diasble zcmp when shrink-wrap-separate is actually active. 

Thanks Kito and Andrew Pinski for your patience.

BR, 
Fei
>On Mon, May 8, 2023 at 4:54 PM Fei Gao <gaofei@eswincomputing.com> wrote:
>>
>> On 2023-05-08 16:05  Kito Cheng <kito.cheng@gmail.com> wrote:
>> >
>> >> > diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
>> >> > index 45a63cab9c9..629e5e45cac 100644
>> >> > --- a/gcc/config/riscv/riscv.cc
>> >> > +++ b/gcc/config/riscv/riscv.cc
>> >> > @@ -5729,7 +5729,8 @@ riscv_get_separate_components (void)
>> >> >
>> >> >    if (riscv_use_save_libcall (&cfun->machine->frame)
>> >> >        || cfun->machine->interrupt_handler_p
>> >> > -      || !cfun->machine->frame.gp_sp_offset.is_constant ())
>> >> > +      || !cfun->machine->frame.gp_sp_offset.is_constant ()
>> >> > +      || TARGET_ZCMP)
>> >> >      return components;
>> >>
>> >> I think this is a bad idea. I have a use case where we use the C
>> >> extensions but still compile for -O2 because we want the code to be
>> >> fast as possible but still having the savings of the C extensions.
>> >
>> >Yeah, agree, so I would prefer to drop this from the patch series.
>>
>> Zcmp is a little different here than C.
>> C extension is done fully in AS.  So  we have the code to be
>> fast as possible but still having the savings of the C extensions.
>>
>> Zcmp and shrink-wrap-separate are both done in prologue/epilogue pass
>> and you can only have one switch active to direct sregs save and restore.
>> In my understanding, zcmp push and pop insns seem to
>> be mutually exclusive in functionality to shrink-wrap-separate.
>> It's not expected to see zcmp insns at the begining/end of prologue/epilogue,
>> and also repeated store/load sregs in separate blocks.
>>
>> Same for save and restore, and i guess that's why we have
>> riscv_use_save_libcall (&cfun->machine->frame) check here.
>>
>> BR,
>> Fei
>>
>> >
>> >> Thanks,
>> >> Andrew Pinski

  reply	other threads:[~2023-05-10  9:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06  8:39 [PATCH 0/2] RISC-V: support Zcmp extension Fei Gao
2023-05-06  8:39 ` [PATCH 1/2] [RISC-V] disable shrink-wrap-separate if zcmp enabled Fei Gao
2023-05-08  2:41   ` Kito Cheng
2023-05-08  7:39     ` Fei Gao
2023-05-08  7:54   ` Andrew Pinski
2023-05-08  8:05     ` Kito Cheng
2023-05-08  8:54       ` Fei Gao
2023-05-08  9:20         ` Kito Cheng
2023-05-10  9:33           ` Fei Gao [this message]
2023-05-06  8:39 ` [PATCH 2/2] [RISC-V] support cm.push cm.pop cm.popret in zcmp Fei Gao
2023-05-08  2:48   ` Kito Cheng
2023-05-10  9:34     ` Fei Gao

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=20230510173316379068161@eswincomputing.com \
    --to=gaofei@eswincomputing.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jiawei@iscas.ac.cn \
    --cc=kito.cheng@gmail.com \
    --cc=liaozhangjin@eswincomputing.com \
    --cc=palmer@dabbelt.com \
    --cc=pinskia@gmail.com \
    --cc=sinan.lin@linux.alibaba.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).