From patchwork Mon Oct 17 23:25:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 3824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1687608wrs; Mon, 17 Oct 2022 16:26:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58mHT3KkLYJsLDZIfLP05yJK+KgFFdf+y+iSCCdxMAEVjqi0mD8N8eUTddtCnHrSf4XP5B X-Received: by 2002:a17:907:7b93:b0:770:1d4f:4de9 with SMTP id ne19-20020a1709077b9300b007701d4f4de9mr88474ejc.201.1666049186767; Mon, 17 Oct 2022 16:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666049186; cv=none; d=google.com; s=arc-20160816; b=fmGxxw0yUptKxOHikIxinVj3RwacNqEA6Jjw5R9jy6F1g6PkiWHMKSq/ap1HQnQaQa hYtv31uTCejdMhkagkTJ/ZpZ/3wk+Cduj6+HFx5ZuTCcFUK2vF9FyhxRGCsvMgDPtit6 Pxf+rFwI5OPxponFwVzmEeNuHy6epE9rN7Co81eVZLbLDITQMmSON0RD/s6WwftLdTld DjVYGMgXVQIONsQtFUj+c3asa2uoYrFGtAZD/tzOWpN8OJgyt+MpcLuO6HgWxJUMjVOB ik8Jkbh/QYpo94qo+6lFmb/XSiQHWxMGZQPShJe6P1sf4QY+qr8ASy0CnFFGV8Juwmlg OYyA== 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:subject:to :content-language:user-agent:mime-version:date:message-id :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=yGDNrlubAsyZYP3dwV9cccVW03/M9xcsyKBn3/hrcmI=; b=WQKYWWJFztEj7zWf7UI5PItX9PtmYCnFdT9FRRA32N4vsw4HSr8EQZRu8JRTttn4sU 6cSNdbJ1UWFSDtsrPty3VF75u0mzrkL2cvzHfcXdkwE8xlbEmPKCmUC8PZ/gbcF8GOvu 32BYYDB/C+7vARVm4dol+df67PS7yP6BBqcz+2Y7KYW3RuXw3xN9pb1joxGVQjKVHuHJ cpCxp7vwddJgLxFwIxCLlH/UKtS/F0LQH3Ap1sxUDR/PoawSCGkP9KqrLQ6KkMeX3QwE sflKqC5kC9BQjbun61MRHiZ2NIHvXoCNkwVvKANjfQC38o8ldAC9CrNIVXY5Ltb0L60C Sfyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n6ecdm9h; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b19-20020a056402351300b00459e1ce80a7si21086edd.241.2022.10.17.16.26.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 16:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=n6ecdm9h; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 8D1D73858014 for ; Mon, 17 Oct 2022 23:26:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D1D73858014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666049185; bh=yGDNrlubAsyZYP3dwV9cccVW03/M9xcsyKBn3/hrcmI=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=n6ecdm9h4vRClmALLisIBzWn7OJRSDEgMhPoTIKC88zs8BYgnBv/fiV0397KAHayB 419XxDmzWENBwFrbgY5X69mTsPT3ZkCygfBZuS9FMK8hdDqQRG2h1O3D3miNJ9M5Nm C3Uu3dp11oYheWK2u0BAZp1XjJpsug3T4Ycp3TdY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id A096E3858D32 for ; Mon, 17 Oct 2022 23:25:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A096E3858D32 Received: by mail-pl1-x62a.google.com with SMTP id l1so12157320pld.13 for ; Mon, 17 Oct 2022 16:25:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yGDNrlubAsyZYP3dwV9cccVW03/M9xcsyKBn3/hrcmI=; b=52GeCT8rTCEGKOcB69T0ozI9LD933g9vF1xUr9yqkM6aFWbmHR8w3n+PjTjcU+Iu/0 kRZn4eatHUdJYD+xRiayS4m4y/czArd2/3fnhonCtnTgwL8Hlpo/IoLbkhUZI0KA+8J7 YdSU/90EsTJJnyQZ4l38OSX3uzB++0oj+wBu8f5sIX4TDYXmq5l5lwldBEMrxUi57bsk hOd99VaxSeUsA6cVVVbGov9giOiPLKwjvwFMaheDbwWOICzbdw2OYHu31bRatMwz58sv Xt1s/bKUf9W4sx7DlynqS5ZL4Ff//lBtFIgrpyktCv/lfcWRkEt2DvmdPnKkcSyDINeL 2YsA== X-Gm-Message-State: ACrzQf31NMQSITMcSBPi8BCOhZVPU0bnTBRKpjSXxhIOBJCONUxZo45L 4j6Zv4RqM3ITiwTMbf5cTVpmQ8zAJKY= X-Received: by 2002:a17:902:9005:b0:181:898b:646d with SMTP id a5-20020a170902900500b00181898b646dmr35798plp.97.1666049141160; Mon, 17 Oct 2022 16:25:41 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id i3-20020a17090ac40300b002036006d65bsm6736414pjt.39.2022.10.17.16.25.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Oct 2022 16:25:40 -0700 (PDT) Message-ID: Date: Mon, 17 Oct 2022 17:25:39 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Subject: [committed] Add missing splitter for H8 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jeff Law via Gcc-patches From: Jeff Law Reply-To: Jeff Law 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?1746979191902826013?= X-GMAIL-MSGID: =?utf-8?q?1746979191902826013?= While testing a minor optimization on the H8 my builds failed due to failure to split a zero-extended memory load.    That particular pattern is a bit special on the H8 in that it's split at assembly time primarily to get the length computations correct.  Arguably that alternative should go away completely, but I haven't really looked into that. Anyway, with the final-asm split we obviously need to match a define_split somewhere.  But none was ever written after adding CCZN optimizations.  So if we had a zero extend of a memory operand and it was used to eliminate a compare, then we'd abort at final asm time. Regression tested (in conjunction with various other in-progress patches) on H8 without regressions. Installed on the trunk. Jeff commit 43ee3f64cb519f2675fa1771007d4aa3baba944f Author: Jeff Law Date: Mon Oct 17 19:19:25 2022 -0400 Add missing splitter for H8 While testing a minor optimization on the H8 my builds failed due to failure to split a zero-extended memory load. That particular pattern is a bit special on the H8 in that it's split at assembly time primarily to get the length computations correct. Arguably that alternative should go away completely, but I haven't really looked into that. Anyway, with the final-asm split we obviously need to match a define_split somewhere. But none was ever written after adding CCZN optimizations. So if we had a zero extend of a memory operand and it was used to eliminate a compare, then we'd abort at final asm time. Regression tested (in conjunction with various other in-progress patches) on H8 without regressions. gcc/ * config/h8300/extensions.md (CCZN setting zero extended load): Add missing splitter. diff --git a/gcc/config/h8300/extensions.md b/gcc/config/h8300/extensions.md index 74647c79cd8..7149dc0ac52 100644 --- a/gcc/config/h8300/extensions.md +++ b/gcc/config/h8300/extensions.md @@ -47,6 +47,24 @@ operands[2] = gen_rtx_REG (QImode, REGNO (operands[0])); }) +;; Similarly, but setting cczn. +(define_split + [(set (reg:CCZN CC_REG) + (compare:CCZN + (zero_extend:HI (match_operand:QI 1 "general_operand_src" "")) + (const_int 0))) + (set (match_operand:HI 0 "register_operand" "") + (zero_extend:HI (match_dup 1)))] + "!REG_P (operands[1]) && reload_completed" + [(parallel [(set (match_dup 2) (match_dup 1)) + (clobber (reg:CC CC_REG))]) + (parallel [(set (reg:CCZN CC_REG) + (compare:CCZN (zero_extend:HI (match_dup 2)) (const_int 0))) + (set (match_dup 0) (zero_extend:HI (match_dup 2)))])] + { + operands[2] = gen_rtx_REG (QImode, REGNO (operands[0])); + }) + (define_insn "*zero_extendqisi2" [(set (match_operand:SI 0 "register_operand" "=r,r") (zero_extend:SI (match_operand:QI 1 "general_operand_src" "0,g>")))]