From: Jeff Law <jeffreyalaw@gmail.com>
To: Fei Gao <gaofei@eswincomputing.com>, gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, palmer@dabbelt.com
Subject: Re: [PATCH 2/3] RISC-V: optimize stack manipulation in save-restore
Date: Mon, 17 Apr 2023 16:51:32 -0600 [thread overview]
Message-ID: <b8fb1f17-7e5d-5c64-f2cf-8bd96b54216e@gmail.com> (raw)
In-Reply-To: <20221201100332.22226-3-gaofei@eswincomputing.com>
On 12/1/22 03:03, Fei Gao wrote:
> The stack that save-restore reserves is not well accumulated in stack allocation and deallocation.
> This patch allows less instructions to be used in stack allocation and deallocation if save-restore enabled.
>
> before patch:
> bar:
> call t0,__riscv_save_4
> addi sp,sp,-64
> ...
> li t0,-12288
> addi t0,t0,-1968 # optimized out after patch
> add sp,sp,t0 # prologue
> ...
> li t0,12288 # epilogue
> addi t0,t0,2000 # optimized out after patch
> add sp,sp,t0
> ...
> addi sp,sp,32
> tail __riscv_restore_4
>
> after patch:
> bar:
> call t0,__riscv_save_4
> addi sp,sp,-2032
> ...
> li t0,-12288
> add sp,sp,t0 # prologue
> ...
> li t0,12288 # epilogue
> add sp,sp,t0
> ...
> addi sp,sp,2032
> tail __riscv_restore_4
>
> gcc/ChangeLog:
>
> * config/riscv/riscv.cc (riscv_expand_prologue): consider save-restore in stack allocation.
> (riscv_expand_epilogue): consider save-restore in stack deallocation.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/riscv/stack_save_restore.c: New test.
I made a couple of whitespace fixes and pushed this to the trunk after
running it through a cross testing cycle.
Thanks!
jeff
next prev parent reply other threads:[~2023-04-17 22:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 10:03 [PATCH 0/3] " Fei Gao
2022-12-01 10:03 ` [PATCH 1/3] RISC-V: add a new parameter in riscv_first_stack_step Fei Gao
2023-02-03 8:52 ` [PING][PATCH " Fei Gao
2023-04-16 16:40 ` [PATCH " Jeff Law
2023-04-17 18:09 ` Jeff Law
2022-12-01 10:03 ` [PATCH 2/3] RISC-V: optimize stack manipulation in save-restore Fei Gao
2023-02-03 8:52 ` [PING] " Fei Gao
2023-04-16 16:45 ` Jeff Law
2023-04-17 22:51 ` Jeff Law [this message]
2022-12-01 10:03 ` [PATCH 3/3] RISC-V: make the stack manipulation codes more readable Fei Gao
2023-02-03 8:52 ` [PING] " Fei Gao
2023-04-18 0:14 ` Jeff Law
2023-02-03 8:52 ` [PING] [PATCH 0/3] RISC-V: optimize stack manipulation in save-restore Fei Gao
2023-02-09 2:21 ` [PING 2] " Fei Gao
2023-02-16 7:17 ` Fei Gao
2023-02-16 14:39 ` Jeff Law
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=b8fb1f17-7e5d-5c64-f2cf-8bd96b54216e@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gaofei@eswincomputing.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kito.cheng@gmail.com \
--cc=palmer@dabbelt.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).