From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 05D26385702C for ; Tue, 14 Jun 2022 20:17:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 05D26385702C Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1016409cf0bso2812412fac.12 for ; Tue, 14 Jun 2022 13:17:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HlETofzqazK9vz8j0bvK+JD26xxEoRj62QOF/c6cjj0=; b=m5dqGrQ3NKHshC3wwYwQiQkyZ6agVlEF3DiTQEQkPoD1OwNcNukxxdwAVxL6zNkdB0 44QUGwMiI31U15cyJpC+l5hqnAgNBoO75BjtXVELfWovZeTka9DkqCR5+u37dL9oTEeM O2ER2V/qjusDK3RdT/29mP98e5hkOCVu/gb1usELwGeud8MUM8ORtXM9IhF1m8J3PVeg sRd2zk/5VmhMIOLwHGBGc2EiEm/YBeeSU1FV0temyiNdMozNTjILDRnxcd2qA1wWoUC5 xaWjwe4wcoUi38XXOwaY24uSP6a9oDjoYsWfC3pZZa4cRRjWw9wgP8scrGeG4lNNVrIA VepA== X-Gm-Message-State: AJIora8JahUjI9exhBMrQhTry6W5mHmS2NsnIQFaS4jY9wD+CQtC/y9V 6U2kxx7HUlewFkpmZ0kBTAalAOFuDs1UGgZ57kG/nX1OwghohQ== X-Google-Smtp-Source: AGRyM1uK5xAQITDZrTPSVXuRpaIYkvaEIaiRmb1WwNQzYovPyusm/gfZrLZulrs7rVOdInGrJj4a4iY6+RazpmTKEVg= X-Received: by 2002:a05:6870:e616:b0:fe:9f2:2a76 with SMTP id q22-20020a056870e61600b000fe09f22a76mr3377725oag.55.1655237833332; Tue, 14 Jun 2022 13:17:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Max Filippov Date: Tue, 14 Jun 2022 13:17:03 -0700 Message-ID: Subject: Re: [PATCH 2/5] xtensa: Add support for sibling call optimization To: "Takayuki 'January June' Suwa" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2022 20:17:16 -0000 Hi Suwa-san, On Mon, Jun 13, 2022 at 8:54 PM Takayuki 'January June' Suwa 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