From patchwork Sun Sep 11 11:51:15 2022 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: 1131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1624962wrt; Sun, 11 Sep 2022 13:51:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR46rte45jWf22JLVAMc3UuTJ9nfK2OQ3uwz8W8FSVHuk4ZzZ6NvpJhBeye27qkJbOxw4id0 X-Received: by 2002:a05:6402:4505:b0:451:1551:7b14 with SMTP id ez5-20020a056402450500b0045115517b14mr10273097edb.300.1662929483926; Sun, 11 Sep 2022 13:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662929483; cv=none; d=google.com; s=arc-20160816; b=THgMJLgfNZbxnMDVeje9by1OTlPa+eg0ZH4OItbdkv6CXX+/WBwI0c3dmy6Lq5fEEK UN++Ve0TDrTGVT+BU8GBo0JL82DIdwcPH7vFK0TV9jJgECTcF0XQcESrTKe3y2dIGGwf VPNcdINg01VkHao9UmaZjPifA9G08T+hg/RYJXBkn1ubVRY6fA9H3Y2vmY4jO15Apw7W FBKhGY10+8Uwox+ifivfWEsPgR11j2DNW054vnp/zq4hMhf/x80pQnqKFbc81JTTdiFf 9oA9A7dGOASI9vPOWd8rNwnrwrCa3JN+GhtdUp079WmJZI/HQ13TfMRS1ePNOu2hNsHY nx5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:user-agent:mime-version:date :message-id:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=5NNFUpZ4k5ulHsFq4ngYMil40y9j7wCEQsl4PRKF+w0=; b=zj/ZpJOQMWepUh+6w942HlbOlX8dnHWJjrg4K07UZ/MPEAnUCrjwH9mUdfjokDtqfu n0V9V8c9HOKWnqOg2pRKrePISMXu323xwrohHQPzcqyypoN/2rP0l/XUe0GbolSapDD/ 5/Vw3lnr4CiMJkiyVwo6nzjcKTODPRkTcgAouKt4FdrV2aFp0Ie6AZz66JRqrIEkdXI+ T1LoEU54NlJ6NITUrzTUrvxg+f154y2id+S39N6k/QwsFFbY+pjyIvfCeykWfPW3/UNf A7JPzJeF0HY1jELNIbP4KTl3mvH7jiUFyYhWqrC3IygvWSpI2BJuw0YKuZ+HPSA9QeuD S8EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=m1DLHiw8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id el15-20020a056402360f00b004516b10bb3asi3086447edb.234.2022.09.11.13.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Sep 2022 13:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=m1DLHiw8; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF697385AC24 for ; Sun, 11 Sep 2022 20:51:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF697385AC24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662929470; bh=5NNFUpZ4k5ulHsFq4ngYMil40y9j7wCEQsl4PRKF+w0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=m1DLHiw8L/G7dyDI99kdGlhTwNK769j3UvDxI3fClcGZlUeM7Y5SRgw2hjyKNdMgg f76v+cPFjIKDYl1ZOp1kfaoQC/a5927Cl7Fe8xhGYw1Rr4iWWupfrSkPthA9uNaobW YhXYMJF3lh3XjR2hX8da3hf9qSnaWe4Pd1yzPk7c= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nh503-vm7.bullet.mail.kks.yahoo.co.jp (nh503-vm7.bullet.mail.kks.yahoo.co.jp [183.79.56.193]) by sourceware.org (Postfix) with SMTP id D0B703858D32 for ; Sun, 11 Sep 2022 20:50:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0B703858D32 Received: from [183.79.100.141] by nh503.bullet.mail.kks.yahoo.co.jp with NNFMP; 11 Sep 2022 20:50:22 -0000 Received: from [183.79.100.134] by t504.bullet.mail.kks.yahoo.co.jp with NNFMP; 11 Sep 2022 20:50:22 -0000 Received: from [127.0.0.1] by omp503.mail.kks.yahoo.co.jp with NNFMP; 11 Sep 2022 20:50:22 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 234846.89823.bm@omp503.mail.kks.yahoo.co.jp Received: (qmail 93248 invoked by alias); 11 Sep 2022 20:50:22 -0000 Received: from unknown (HELO ?192.168.150.64?) (183.77.162.44 with ) by smtp6008.mail.ssk.ynwp.yahoo.co.jp with SMTP; 11 Sep 2022 20:50:22 -0000 X-YMail-JAS: Xi.m5TEVM1kdlzywUlIASHA1DcLlBtH9EUNKqM.4a0sUH6Ar26FY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15UUEzLhx8F1CJ3 Message-ID: <1e87f131-93eb-0d37-d0f4-a9a69a5dc61f@yahoo.co.jp> Date: Sun, 11 Sep 2022 20:51:15 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 To: GCC Patches Subject: [PATCH 2/2] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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, T_SCC_BODY_TEXT_LINE 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Takayuki 'January June' Suwa via Gcc-patches From: Takayuki 'January June' Suwa Reply-To: Takayuki 'January June' Suwa Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743707946726938204?= X-GMAIL-MSGID: =?utf-8?q?1743707946726938204?= This patch implements new target hook TARGET_CONSTANT_OK_FOR_CPROP_P in order to exclude CONST_INTs that cannot fit into a MOVI machine instruction from cprop. gcc/ChangeLog: * config/xtensa/xtensa.c (TARGET_CONSTANT_OK_FOR_CPROP_P): New macro definition. (xtensa_constant_ok_for_cprop_p): Implement the hook as mentioned above. --- gcc/config/xtensa/xtensa.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index ac52c015a94..5c432cc65aa 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -191,6 +191,7 @@ static bool xtensa_can_eliminate (const int from ATTRIBUTE_UNUSED, static HOST_WIDE_INT xtensa_starting_frame_offset (void); static unsigned HOST_WIDE_INT xtensa_asan_shadow_offset (void); static bool xtensa_function_ok_for_sibcall (tree, tree); +static bool xtensa_constant_ok_for_cprop_p (const_rtx); static rtx xtensa_delegitimize_address (rtx); @@ -345,12 +346,15 @@ static rtx xtensa_delegitimize_address (rtx); #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed -#undef TARGET_DELEGITIMIZE_ADDRESS -#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address - #undef TARGET_FUNCTION_OK_FOR_SIBCALL #define TARGET_FUNCTION_OK_FOR_SIBCALL xtensa_function_ok_for_sibcall +#undef TARGET_CONSTANT_OK_FOR_CPROP_P +#define TARGET_CONSTANT_OK_FOR_CPROP_P xtensa_constant_ok_for_cprop_p + +#undef TARGET_DELEGITIMIZE_ADDRESS +#define TARGET_DELEGITIMIZE_ADDRESS xtensa_delegitimize_address + struct gcc_target targetm = TARGET_INITIALIZER; @@ -4983,6 +4987,16 @@ xtensa_function_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED, tree exp ATTRIBUTE_U return true; } +/* Implement TARGET_CONSTANT_OK_FOR_CPROP_P. */ +static bool +xtensa_constant_ok_for_cprop_p (const_rtx x) +{ + if (CONST_INT_P (x) && ! xtensa_simm12b (INTVAL (x))) + return false; + + return true; +} + static rtx xtensa_delegitimize_address (rtx op) {