From patchwork Fri Jul 19 20:35:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takayuki 'January June' Suwa X-Patchwork-Id: 94248 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2656D38460A0 for ; Fri, 19 Jul 2024 20:36:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omggw7007-vm0.mail.djm.yahoo.co.jp (omggw7007-vm0.mail.djm.yahoo.co.jp [183.79.54.132]) by sourceware.org (Postfix) with ESMTPS id 5A7B7385DDC5 for ; Fri, 19 Jul 2024 20:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A7B7385DDC5 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5A7B7385DDC5 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=183.79.54.132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721421343; cv=none; b=PLS4JJgu1kJAURv+fwNTOVhf9DFvgLEcrBD989ha3jqFOgaRt/x+FgDOskJnQ+JFB0bvE6cpgwGNvPhiFBUO+G/40QJiZSRnhHYLSRIcmN+GHEWEhloRsKslOD2m2M8MyhWZlEe/GdrSO4evhbXPRfUpwN3shL4n0iqPjtBKL30= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721421343; c=relaxed/simple; bh=+awgCratZYugqAdK2Nohtk5sprr8Hd7YTDRhoeAo6qg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=nJA0cJ/0bq+ySiq/LDQAUdfVG6FteOLqK7jYI9SpOlmRJ8jkAF2M+6qZTYKF5l89DOnfC78ufI7485KihI3bKR+ilwV/Mfi6JegRe3CxJS3Mu27VpOy+ttKiItjxqG7oIzTQ2bKzJqeJcn1llgmaNGwal0O6+vXTUNQHv2GRiaQ= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: iKTfZJ8VM1mQ_CQIzk8PFE3T_p.2gj.TIr8d9OP_Sz_4ysjzcitAmvREH.n14yt XVR.yxXtGESyoU08P9JeTNIzFYTwUm3T3wq862G6hkBKz7s7TL3GuLw36coQYigngb.XPMrmKp34 5GmsrG9JnvAon7Y.HPtMxK3ERREtCDW49Nuyku9w96lvP3I1Kjw_1154KPwuKYujmeIbAEt03g6w LT7BJO5aB_ibXv2efkMqXWzqn9W3nTqtPL1sW46qNOj5f34VY_IVZyGDJEQefW0ZhHh6iOdc2IuH u00Vvkk1CQY9hy7_wV_ofXDUKd0ePo4jDVkliXkJkBks_mdlfrjdkOG2941T.w0wkyNuWL1psvrG nBCXF4ACLtqAFH5ReOAL9ZLpGUQX6aukjSgDXP7cg6ZlCoQs202BGEuedty8uC0Plr0xJgvIHkXO QCOM4loZxdOTFB7ZbtHTyeXyL4Z27pkPfYvrJMKOXc72vOB7dpeGwjgBkLZ54HWQmL6z_vyBwydA qwvtVpbUiOiOnnVkroRizM105N7P3LpMyvbeQ90qcIzojzqAr5cwUsyeD8QK5frTf9_.fahDhVCP zbjAgN0JUs0rGddms9CbFKn2K2y9lJFjw2o11MX9WtaIkr2GCHl2xTN9edyrb5gyfNw0n8BHoioS wJRmX2oYCIquUuEO4O3QKOralJmAUFZxQeuqJp6_GHkwTYJmweOMbqyALZGr5A8aRcVcrBHiFCDz BZtOr_O8XUp84WOJEldUzZTRyPNjgC9_QHshkgLZWif10bHfERolEUZj1hFYpM1WAgWeXc9pq1LT bLtE5BVs7cwXsD1MrBVaMDigiot0swb0UDddlNYEd9f4FRDmh02lywdGAYiuwRlTFqoG3b1OqfG3 r1U1WPtsx3z7Ej.IvWBEseLkZuQ7sGbpNKM.DOfzhuIWGbq.uhoputB7lhPzvCnyrdpP7BNzUHTp DNRgcZfjYk1gb15evMj..PU4W4gHBiR6iOIpglCqRGxZrH9dFY897xMmhW2JTNzPvvsValjuQ1Yj OspUzZlDpqqM2LwwSqmmVwIDVELnSPgP5q._25uEL5SiuDe0KSgWDaXI5CTz5saNHVlrTLqMiNZw YaC2P4wzyK9W4EiEoOyRztKqMw5hhsg9rQLzlMtiQIoOFFJvMswogJYkBahN_BiKQ0CPANCIUbiY Q9ks0gxZDCGV4VMwh9RbzOA-- Received: from sonicgw.mail.yahoo.co.jp by sonicconh5003.mail.kks.yahoo.co.jp with HTTP; Fri, 19 Jul 2024 20:35:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1721421333; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=TXrcqgEhzXr4vvOeg+Z2QE3IbNJ7GcBum1B5jTkaHt8=; b=B36KX6NNDn5T5eIj7sGYUmWu3dSAV/drdMkQLW2Ldf/51DwAvMf+iKiI8K3RZCZg caooF+Dyw+GaYagLnhXOxrzbiAuUq4EWF4P9468mA5JtJ7M9qUX7zTUUiUV+klb/VVA X+MfHGDDDIw0eVN9IHj4REnt1x2dWhtxdedVgIfw= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Cc:From:Content-Type:Content-Transfer-Encoding:References; b=VctYTF2LjoYa4vRji0EpXht/6K1+2MVNiiIaSeRtkez1sTMY2n+ip9RGbYCMObKT Gk871QFrL70uaMwX8QCl6wXzuGqkWqMPVjKtCGCkHqOIX3o4wA9m9V+DzIkuGPAH8my zbPhkFw2Amn5eyDq1I14sKIMuaSXh3Z/pTsgBDYw=; Received: by smtphe5007.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID e5137fe634762daed74baac90a547a2d; Sat, 20 Jul 2024 05:35:35 +0900 (JST) Message-ID: <3b6c25bd-2e0a-468c-b202-d2de3a8779f3@yahoo.co.jp> Date: Sat, 20 Jul 2024 05:35:33 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH] xtensa: Fix the regression introduce by abe81aa19f250516fd57f76cad9c0920cce221bc References: <3b6c25bd-2e0a-468c-b202-d2de3a8779f3.ref@yahoo.co.jp> X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org It is not wrong but also not optimal to specify that sibcalls require register A0 in RTX generation pass, by misleading DFA into thinking it is being used in function body. It would be better to specify it in pro_and_epilogue as with 'return' insn in order to avoid incorrect removing load that restores A0 in subsequent passes, but since it is not possible to modify each sibcall there, as a workaround we will preface it with a 'use' as before. This patch effectively reverts commit abe81aa19f250516fd57f76cad9c0920cce221bc. gcc/ChangeLog: * config/xtensa/xtensa-protos.h (xtensa_expand_call): Remove the third argument. * config/xtensa/xtensa.cc (xtensa_expand_call): Remove the third argument and the code that uses it. * config/xtensa/xtensa.md (call, call_value, sibcall, sibcall_value): Remove each Boolean constant specified in the third argument of xtensa_expand_call. (sibcall_epilogue): Add emitting '(use A0_REG)' after calling xtensa_expand_epilogue. --- gcc/config/xtensa/xtensa-protos.h | 2 +- gcc/config/xtensa/xtensa.cc | 10 +--------- gcc/config/xtensa/xtensa.md | 9 +++++---- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 8f645e87de9..3646ceaa093 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -53,7 +53,7 @@ extern void xtensa_expand_atomic (enum rtx_code, rtx, rtx, rtx, bool); extern void xtensa_emit_loop_end (rtx_insn *, rtx *); extern char *xtensa_emit_branch (bool, rtx *); extern char *xtensa_emit_movcc (bool, bool, bool, rtx *); -extern void xtensa_expand_call (int, rtx *, bool); +extern void xtensa_expand_call (int, rtx *); extern char *xtensa_emit_call (int, rtx *); extern char *xtensa_emit_sibcall (int, rtx *); extern bool xtensa_tls_referenced_p (rtx); diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index d49d224466a..431e3627e9f 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -2301,7 +2301,7 @@ xtensa_emit_movcc (bool inverted, bool isfp, bool isbool, rtx *operands) void -xtensa_expand_call (int callop, rtx *operands, bool sibcall_p) +xtensa_expand_call (int callop, rtx *operands) { rtx call; rtx_insn *call_insn; @@ -2343,14 +2343,6 @@ xtensa_expand_call (int callop, rtx *operands, bool sibcall_p) CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (Pmode, clob, CALL_INSN_FUNCTION_USAGE (call_insn)); } - else if (sibcall_p) - { - /* Sibling call requires a return address to the caller, similar to - "return" insn. */ - rtx use = gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, A0_REG)); - CALL_INSN_FUNCTION_USAGE (call_insn) = - gen_rtx_EXPR_LIST (Pmode, use, CALL_INSN_FUNCTION_USAGE (call_insn)); - } } diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 8709ef6d7a7..d074792575e 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2565,7 +2565,7 @@ (match_operand 1 "" ""))] "" { - xtensa_expand_call (0, operands, false); + xtensa_expand_call (0, operands); DONE; }) @@ -2586,7 +2586,7 @@ (match_operand 2 "" "")))] "" { - xtensa_expand_call (1, operands, false); + xtensa_expand_call (1, operands); DONE; }) @@ -2607,7 +2607,7 @@ (match_operand 1 "" ""))] "!TARGET_WINDOWED_ABI" { - xtensa_expand_call (0, operands, true); + xtensa_expand_call (0, operands); DONE; }) @@ -2628,7 +2628,7 @@ (match_operand 2 "" "")))] "!TARGET_WINDOWED_ABI" { - xtensa_expand_call (1, operands, true); + xtensa_expand_call (1, operands); DONE; }) @@ -2745,6 +2745,7 @@ "!TARGET_WINDOWED_ABI" { xtensa_expand_epilogue (); + emit_use (gen_rtx_REG (SImode, A0_REG)); DONE; })