public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@sifive.com>
To: "juzhe.zhong" <juzhe.zhong@rivai.ai>
Cc: jiawei <jiawei@iscas.ac.cn>, "kito.cheng" <kito.cheng@gmail.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>,
	palmer <palmer@rivosinc.com>,
	 "christoph.muellner" <christoph.muellner@vrull.eu>,
	"philipp.tomsich" <philipp.tomsich@vrull.eu>,
	 wuwei2016 <wuwei2016@iscas.ac.cn>
Subject: Re: Re: [PATCH] RISC-V: Optimal RVV epilogue logic.
Date: Mon, 14 Nov 2022 19:13:02 -0800	[thread overview]
Message-ID: <CALLt3ThBh2vN5PNBt6XS1k0ExOu6OSj4e9oa6y+EBAYQaWjCCg@mail.gmail.com> (raw)
In-Reply-To: <D2E4DE46A14ECFAC+202211151046279202294@rivai.ai>

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

I would suggest add a sperated case and scan-assembly-not to demonstrate
this patch.


juzhe.zhong@rivai.ai <juzhe.zhong@rivai.ai> 於 2022年11月15日 週二 10:47 寫道:

> I think you'd better change assembler checking of "spill-*.c" cases.
> Check they don't have "addi sp,sp,0" redundant instruction.
> Let's see whether Kito aggree with that.
> ------------------------------
> juzhe.zhong@rivai.ai
>
>
> *From:* jiawei <jiawei@iscas.ac.cn>
> *Date:* 2022-11-15 10:37
> *To:* Kito Cheng <kito.cheng@gmail.com>
> *CC:* gcc-patches <gcc-patches@gcc.gnu.org>; kito.cheng
> <kito.cheng@sifive.com>; palmer <palmer@rivosinc.com>; juzhe.zhong
> <juzhe.zhong@rivai.ai>; christoph.muellner <christoph.muellner@vrull.eu>;
> philipp.tomsich <philipp.tomsich@vrull.eu>; wuwei2016
> <wuwei2016@iscas.ac.cn>
> *Subject:* Re: Re: [PATCH] RISC-V: Optimal RVV epilogue logic.
> &gt; -----原始邮件-----
> &gt; 发件人: "Kito Cheng" <kito.cheng@gmail.com>
> &gt; 发送时间: 2022-11-15 09:48:26 (星期二)
> &gt; 收件人: jiawei <jiawei@iscas.ac.cn>
> &gt; 抄送: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com,
> palmer@rivosinc.com, juzhe.zhong@rivai.ai, christoph.muellner@vrull.eu,
> philipp.tomsich@vrull.eu, wuwei2016@iscas.ac.cn
> &gt; 主题: Re: [PATCH] RISC-V: Optimal RVV epilogue logic.
> &gt;
> &gt; Could you provide some testcase?
>
> Sorry for not giving a clear description,
>
> You can use amost all testcases in gcc.target/riscv/rvv/base/spill-*.c
>
> compile with -march=rv64gcv and check the assemble file spill-*.s,
>
> before this patch, it will generate assemble code contain additional
>
> `addi sp,sp,0`:
>
> ```
>         csrr    t0,vlenb
>         slli    t1,t0,1
>         add     sp,sp,t1
>         addi    sp,sp,0
>         ld      s0,24(sp)
>         addi    sp,sp,32
>         jr      ra
> ```
>
> after this patch it will removed:
>
> ```
>         csrr    t0,vlenb
>         slli    t1,t0,1
>         add     sp,sp,t1
>         ld      s0,24(sp)
>         addi    sp,sp,32
>         jr      ra
> ```
>
> &gt;
> &gt; On Tue, Nov 15, 2022 at 12:29 AM jiawei <jiawei@iscas.ac.cn> wrote:
> &gt; &gt;
> &gt; &gt; Skip add insn generate if the adjust size equal to zero.
> &gt; &gt;
> &gt; &gt; gcc/ChangeLog:
> &gt; &gt;
> &gt; &gt;         * config/riscv/riscv.cc (riscv_expand_epilogue):
> &gt; &gt;                                 New if control segement.
> &gt; &gt;
> &gt; &gt; ---
> &gt; &gt;  gcc/config/riscv/riscv.cc | 18 ++++++++++--------
> &gt; &gt;  1 file changed, 10 insertions(+), 8 deletions(-)
> &gt; &gt;
> &gt; &gt; diff --git a/gcc/config/riscv/riscv.cc
> b/gcc/config/riscv/riscv.cc
> &gt; &gt; index 02a01ca0b7c..af138db7545 100644
> &gt; &gt; --- a/gcc/config/riscv/riscv.cc
> &gt; &gt; +++ b/gcc/config/riscv/riscv.cc
> &gt; &gt; @@ -5186,24 +5186,26 @@ riscv_expand_epilogue (int style)
> &gt; &gt;         }
> &gt; &gt;
> &gt; &gt;        /* Get an rtx for STEP1 that we can add to BASE.  */
> &gt; &gt; -      rtx adjust = GEN_INT (step1.to_constant ());
> &gt; &gt; -      if (!SMALL_OPERAND (step1.to_constant ()))
> &gt; &gt; +      if (step1.to_constant () != 0){
> &gt; &gt; +        rtx adjust = GEN_INT (step1.to_constant ());
> &gt; &gt; +        if (!SMALL_OPERAND (step1.to_constant ()))
> &gt; &gt;         {
> &gt; &gt;           riscv_emit_move (RISCV_PROLOGUE_TEMP (Pmode), adjust);
> &gt; &gt;           adjust = RISCV_PROLOGUE_TEMP (Pmode);
> &gt; &gt;         }
> &gt; &gt;
> &gt; &gt; -      insn = emit_insn (
> &gt; &gt; +        insn = emit_insn (
> &gt; &gt;                gen_add3_insn (stack_pointer_rtx,
> stack_pointer_rtx, adjust));
> &gt; &gt;
> &gt; &gt; -      rtx dwarf = NULL_RTX;
> &gt; &gt; -      rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode,
> stack_pointer_rtx,
> &gt; &gt; +        rtx dwarf = NULL_RTX;
> &gt; &gt; +        rtx cfa_adjust_rtx = gen_rtx_PLUS (Pmode,
> stack_pointer_rtx,
> &gt; &gt;                                          GEN_INT (step2));
> &gt; &gt;
> &gt; &gt; -      dwarf = alloc_reg_note (REG_CFA_DEF_CFA, cfa_adjust_rtx,
> dwarf);
> &gt; &gt; -      RTX_FRAME_RELATED_P (insn) = 1;
> &gt; &gt; +        dwarf = alloc_reg_note (REG_CFA_DEF_CFA,
> cfa_adjust_rtx, dwarf);
> &gt; &gt; +        RTX_FRAME_RELATED_P (insn) = 1;
> &gt; &gt;
> &gt; &gt; -      REG_NOTES (insn) = dwarf;
> &gt; &gt; +        REG_NOTES (insn) = dwarf;
> &gt; &gt; +      }
> &gt; &gt;      }
> &gt; &gt;    else if (frame_pointer_needed)
> &gt; &gt;      {
> &gt; &gt; --
> &gt; &gt; 2.25.1
> &gt; &gt;
> </jiawei@iscas.ac.cn></jiawei@iscas.ac.cn></kito.cheng@gmail.com>
>
>

  reply	other threads:[~2022-11-15  3:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 16:29 jiawei
2022-11-15  1:48 ` Kito Cheng
2022-11-15  2:37   ` jiawei
2022-11-15  2:46     ` juzhe.zhong
2022-11-15  3:13       ` Kito Cheng [this message]
2022-11-15  3:42         ` Jeff Law
2022-11-15  3:30 ` Jeff Law
2022-11-15 10:35 ` Philipp Tomsich

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=CALLt3ThBh2vN5PNBt6XS1k0ExOu6OSj4e9oa6y+EBAYQaWjCCg@mail.gmail.com \
    --to=kito.cheng@sifive.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jiawei@iscas.ac.cn \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=wuwei2016@iscas.ac.cn \
    /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).