From: Max Filippov <jcmvbkbc@gmail.com>
To: "Takayuki 'January June' Suwa" <jjsuwa_sys3175@yahoo.co.jp>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] xtensa: Optimize stack pointer updates in function pro/epilogue under certain conditions
Date: Wed, 17 Aug 2022 17:49:10 -0700 [thread overview]
Message-ID: <CAMo8BfJGHtMD=0ZBqgiPuw6cVP+c0q-1C1zkDmi52i5cNGmxCQ@mail.gmail.com> (raw)
In-Reply-To: <70d62887-e221-786b-cf16-612be9f7c179@yahoo.co.jp>
On Wed, Aug 17, 2022 at 12:32 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch enforces the use of "addmi" machine instruction instead of
> addition/subtraction with two source registers for adjusting the stack
> pointer, if the adjustment fits into a signed 16-bit and is also a multiple
> of 256.
>
> /* example */
> void test(void) {
> char buffer[4096];
> __asm__(""::"m"(buffer));
> }
>
> ;; before
> test:
> movi.n a9, 1
> slli a9, a9, 12
> sub sp, sp, a9
> movi.n a9, 1
> slli a9, a9, 12
> add.n sp, sp, a9
> addi sp, sp, 0
> ret.n
>
> ;; after
> test:
> addmi sp, sp, -0x1000
> addmi sp, sp, 0x1000
> ret.n
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.cc (xtensa_expand_prologue):
> Use an "addmi" machine instruction for updating the stack pointer
> rather than addition/subtraction via hard register A9, if the amount
> of change satisfies the literal value conditions of that instruction
> when the CALL0 ABI is used.
> (xtensa_expand_epilogue): Ditto.
> And also inhibit the stack pointer addition of constant zero.
> ---
> gcc/config/xtensa/xtensa.cc | 79 +++++++++++++++++++++++++------------
> 1 file changed, 54 insertions(+), 25 deletions(-)
Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.
--
Thanks.
-- Max
prev parent reply other threads:[~2022-08-18 0:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 19:31 Takayuki 'January June' Suwa
2022-08-18 0:49 ` Max Filippov [this message]
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='CAMo8BfJGHtMD=0ZBqgiPuw6cVP+c0q-1C1zkDmi52i5cNGmxCQ@mail.gmail.com' \
--to=jcmvbkbc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jjsuwa_sys3175@yahoo.co.jp \
/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).