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 v2] xtensa: Eliminate the use of callee-saved register that saves and restores only once
Date: Tue, 17 Jan 2023 03:23:12 -0800 [thread overview]
Message-ID: <CAMo8BfJGQZksAWpsW8gVtuTMCYkZ+faV0kd4OBhTMA=k1C3KzQ@mail.gmail.com> (raw)
In-Reply-To: <70bdc2f9-f0ae-cca7-0910-859cacbf5eae@yahoo.co.jp>
Hi Suwa-san,
On Mon, Jan 16, 2023 at 8:12 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> In the case of the CALL0 ABI, values that must be retained before and
> after function calls are placed in the callee-saved registers (A12
> through A15) and referenced later. However, it is often the case that
> the save and the reference are each only once and a simple register-
> register move (the frame pointer is needed to recover the stack pointer
> and must be excluded).
>
> e.g. in the following example, if there are no other occurrences of
> register A14:
>
> ;; before
> ; prologue {
> ...
> s32i.n a14, sp, 16
> ...
> ; } prologue
> ...
> mov.n a14, a6
> ...
> call0 foo
> ...
> mov.n a8, a14
> ...
> ; epilogue {
> ...
> l32i.n a14, sp, 16
> ...
> ; } epilogue
>
> It can be possible like this:
>
> ;; after
> ; prologue {
> ...
> (deleted)
> ...
> ; } prologue
> ...
> s32i.n a6, sp, 16
> ...
> call0 foo
> ...
> l32i.n a8, sp, 16
> ...
> ; epilogue {
> ...
> (deleted)
> ...
> ; } epilogue
>
> This patch introduces a new peephole2 pattern that implements the above.
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.md: New peephole2 pattern that eliminates
> the use of callee-saved register that saves and restores only once
> for other register, by using its stack slot directly.
> ---
> gcc/config/xtensa/xtensa.md | 60 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
There's still a few regressions in tests with -fcompare-debug because
code generated with -g and without it is different:
+FAIL: gcc.dg/pr41241.c (test for excess errors)
+FAIL: gcc.dg/pr48159-1.c (test for excess errors)
+FAIL: gcc.dg/pr65521.c (test for excess errors)
+FAIL: gcc.dg/torture/pr42878-1.c -O2 (test for excess errors)
+FAIL: gcc.dg/torture/pr42878-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (test for
excess errors)
+FAIL: gcc.dg/torture/pr42878-1.c -O3 -g (test for excess errors)
+FAIL: gcc.dg/torture/pr42878-1.c -Os (test for excess errors)
+FAIL: gcc.dg/torture/pr42878-1.c -O2 -flto -fno-use-linker-plugin
-flto-partition=none (test for excess errors)
E.g. check the following test with -g0 and -g:
gcc/cc1 gcc/testsuite/gcc.dg/torture/pr42878-1.c -mlongcalls
-mtext-section-literals -fdiagnostics-plain-output -O3
-fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
-finline-functions
--
Thanks.
-- Max
next prev parent reply other threads:[~2023-01-17 11:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <70bdc2f9-f0ae-cca7-0910-859cacbf5eae.ref@yahoo.co.jp>
2023-01-17 4:12 ` Takayuki 'January June' Suwa
2023-01-17 11:23 ` Max Filippov [this message]
2023-01-18 4:23 ` [PATCH v3] " Takayuki 'January June' Suwa
2023-01-18 9:04 ` Max Filippov
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='CAMo8BfJGQZksAWpsW8gVtuTMCYkZ+faV0kd4OBhTMA=k1C3KzQ@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).