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 2/5] xtensa: Add support for sibling call optimization
Date: Tue, 14 Jun 2022 13:17:03 -0700 [thread overview]
Message-ID: <CAMo8BfKN=qs8tb5=ztrMqBbkK0HMa6yq6G-sNtRAm8Fwmf90ig@mail.gmail.com> (raw)
In-Reply-To: <d96d8040-afee-b2f8-40e4-d050d07ff2e7@yahoo.co.jp>
Hi Suwa-san,
On Mon, Jun 13, 2022 at 8:54 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch introduces support for sibling call optimization, when call0
> ABI is in effect.
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa-protos.h (xtensa_prepare_expand_call,
> xtensa_emit_sibcall): New prototypes.
> (xtensa_expand_epilogue): Add new argument that specifies whether
> or not sibling call.
> * config/xtensa/xtensa.cc (TARGET_FUNCTION_OK_FOR_SIBCALL):
> New macro definition.
> (xtensa_prepare_expand_call): New function in order to share
> the common code.
> (xtensa_emit_sibcall, xtensa_function_ok_for_sibcall):
> New functions.
> (xtensa_expand_epilogue): Add new argument sibcall_p and use it
> for sibling call handling.
> * config/xtensa/xtensa.md (call, call_value):
> Use xtensa_prepare_expand_call.
> (call_internal, call_value_internal):
> Add the condition in order to be disabled if sibling call.
> (sibcall, sibcall_value, sibcall_epilogue): New expansions.
> (sibcall_internal, sibcall_value_internal): New insn patterns.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/xtensa/sibcalls.c: New.
> ---
> gcc/config/xtensa/xtensa-protos.h | 4 +-
> gcc/config/xtensa/xtensa.cc | 63 ++++++++++++++++++--
> gcc/config/xtensa/xtensa.md | 68 +++++++++++++++++-----
> gcc/testsuite/gcc.target/xtensa/sibcalls.c | 15 +++++
> 4 files changed, 130 insertions(+), 20 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/xtensa/sibcalls.c
This change results in a bunch of new regression test failures:
FAIL: gcc.c-torture/execute/builtins/fprintf.c execution, -O2
FAIL: gcc.c-torture/execute/builtins/fprintf.c execution, -O3 -g
FAIL: gcc.c-torture/execute/builtins/fprintf.c execution, -Os
FAIL: gcc.c-torture/execute/builtins/fprintf.c execution, -O2 -flto
-fno-use-linker-plugin -flto-partition=none
FAIL: gcc.c-torture/execute/builtins/memset.c execution, -O2
FAIL: gcc.c-torture/execute/builtins/memset.c execution, -O3 -g
FAIL: gcc.c-torture/execute/builtins/memset.c execution, -Os
FAIL: gcc.c-torture/execute/builtins/memset.c execution, -O2 -flto
-fno-use-linker-plugin -flto-partition=none
FAIL: gcc.c-torture/execute/builtins/printf.c execution, -O2
FAIL: gcc.c-torture/execute/builtins/printf.c execution, -O3 -g
FAIL: gcc.c-torture/execute/builtins/printf.c execution, -Os
FAIL: gcc.c-torture/execute/builtins/printf.c execution, -O2 -flto
-fno-use-linker-plugin -flto-partition=none
FAIL: gcc.c-torture/execute/builtins/strcpy-2.c execution, -O2
FAIL: gcc.c-torture/execute/builtins/strcpy-2.c execution, -O2 -flto
-fno-use-linker-plugin -flto-partition=none
FAIL: gcc.c-torture/execute/builtins/strcpy-2.c execution, -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
FAIL: gcc.c-torture/execute/20000121-1.c -O2 execution test
FAIL: gcc.c-torture/execute/20000121-1.c -O3 -g execution test
FAIL: gcc.c-torture/execute/20000121-1.c -Os execution test
FAIL: gcc.c-torture/execute/20000121-1.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/921208-2.c -O2 execution test
FAIL: gcc.c-torture/execute/921208-2.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.c-torture/execute/921208-2.c -O3 -g execution test
FAIL: gcc.c-torture/execute/921208-2.c -Os execution test
FAIL: gcc.c-torture/execute/921208-2.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr33992.c -O2 execution test
FAIL: gcc.c-torture/execute/pr33992.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.c-torture/execute/pr33992.c -O3 -g execution test
FAIL: gcc.c-torture/execute/pr33992.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr49161.c -O2 execution test
FAIL: gcc.c-torture/execute/pr49161.c -O3 -g execution test
FAIL: gcc.c-torture/execute/pr49161.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr88714.c -O2 execution test
FAIL: gcc.c-torture/execute/pr88714.c -O3 -g execution test
FAIL: gcc.c-torture/execute/pr88714.c -Os execution test
FAIL: gcc.c-torture/execute/pr88714.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr88714.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: gcc.c-torture/execute/pr88739.c -O2 execution test
FAIL: gcc.c-torture/execute/pr88739.c -O3 -g execution test
FAIL: gcc.c-torture/execute/pr88739.c -Os execution test
FAIL: gcc.c-torture/execute/pr88739.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr90949.c -O2 execution test
FAIL: gcc.c-torture/execute/pr90949.c -O3 -g execution test
FAIL: gcc.c-torture/execute/pr90949.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/pr90949.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: gcc.c-torture/execute/printf-2.c -O2 execution test
FAIL: gcc.c-torture/execute/printf-2.c -O3 -g execution test
FAIL: gcc.c-torture/execute/printf-2.c -Os execution test
FAIL: gcc.c-torture/execute/printf-2.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.c-torture/execute/printf-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: gcc.dg/packed-array.c execution test
FAIL: gcc.dg/pr20115.c execution test
FAIL: gcc.dg/pr44404.c execution test
FAIL: gcc.dg/pr81292-2.c execution test
FAIL: gcc.dg/strlenopt-31.c execution test
FAIL: gcc.dg/strlenopt-81.c execution test
FAIL: gcc.dg/torture/builtin-complex-1.c -O2 execution test
FAIL: gcc.dg/torture/builtin-complex-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/builtin-complex-1.c -O3 -g execution test
FAIL: gcc.dg/torture/builtin-complex-1.c -Os execution test
FAIL: gcc.dg/torture/builtin-complex-1.c -O2 -flto
-fno-use-linker-plugin -flto-partition=none execution test
FAIL: gcc.dg/torture/pr56661.c -Os execution test
FAIL: gcc.dg/torture/pr65077.c -O2 execution test
FAIL: gcc.dg/torture/pr65077.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/pr65077.c -O3 -g execution test
FAIL: gcc.dg/torture/pr65077.c -Os execution test
FAIL: gcc.dg/torture/pr65077.c -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: gcc.dg/torture/pr67916.c -O2 execution test
FAIL: gcc.dg/torture/pr67916.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/pr67916.c -O3 -g execution test
FAIL: gcc.dg/torture/pr67916.c -Os execution test
FAIL: gcc.dg/torture/pr67916.c -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: gcc.dg/tree-ssa/cswtch-3.c execution test
FAIL: gcc.dg/tree-ssa/predcom-dse-5.c execution test
FAIL: gcc.dg/tree-ssa/predcom-dse-6.c execution test
FAIL: gcc.dg/tree-ssa/predcom-dse-7.c execution test
The code generated for e.g. gcc.c-torture/execute/921208-2.c looks like this:
.file "921208-2.c"
.text
.literal_position
.align 4
.global g
.type g, @function
g:
ret.n
.size g, .-g
.literal_position
.literal .LC1, g@PLT
.literal .LC3, 1072693248
.literal .LC4, 1073741824
.align 4
.global f
.type f, @function
f:
addi sp, sp, -16
s32i.n a13, sp, 4
l32r a13, .LC3
s32i.n a12, sp, 8
s32i.n a14, sp, 0
movi.n a12, 0
l32r a14, .LC1
s32i.n a0, sp, 12
mov.n a3, a13
mov.n a4, a12
mov.n a5, a13
mov.n a2, a12
callx0 a14
l32i.n a0, sp, 12
l32i.n a14, sp, 0
mov.n a4, a12
mov.n a5, a13
l32i.n a12, sp, 8
l32i.n a13, sp, 4
l32r a3, .LC4
movi.n a2, 0
addi sp, sp, 16
jx a14
.size f, .-f
.section .text.startup,"ax",@progbits
.literal_position
.literal .LC5, f@PLT
.literal .LC6, exit@PLT
.align 4
.global main
.type main, @function
main:
addi sp, sp, -16
l32r a2, .LC5
s32i.n a0, sp, 12
callx0 a2
l32r a3, .LC6
movi.n a2, 0
callx0 a3
.size main, .-main
.ident "GCC: (GNU) 13.0.0 20220614 (experimental)"
--
Thanks.
-- Max
next prev parent reply other threads:[~2022-06-14 20:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 3:36 Takayuki 'January June' Suwa
2022-06-14 20:17 ` Max Filippov [this message]
2022-06-15 12:21 ` [PATCH v2 " Takayuki 'January June' Suwa
2022-06-16 0:00 ` 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='CAMo8BfKN=qs8tb5=ztrMqBbkK0HMa6yq6G-sNtRAm8Fwmf90ig@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).