From patchwork Sun Oct 16 16:51:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 3073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1085639wrs; Sun, 16 Oct 2022 09:52:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5g6YAmcpTV0cM0zZoXmfX2lNk8prKdW/eInVhvKioiPyUby/K1oM3b0EjNw3z42Cv8Tcgc X-Received: by 2002:a17:907:7f1c:b0:78d:ddc7:dfb1 with SMTP id qf28-20020a1709077f1c00b0078dddc7dfb1mr5924695ejc.189.1665939165521; Sun, 16 Oct 2022 09:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665939165; cv=none; d=google.com; s=arc-20160816; b=S/oHCGpOYq4GaKnUBv/XlQDadjwaHAL5fvPv2BFcYCw93o2Aw6d4vXOT23cado5z48 +T0u0fGDdh7C1/9A//di9Oa+nqnVFsD6yPaaYcPWNajOCOfRRIOMYetQmkvlc6ZBy7il fD4MRCellCMDRZT+qXFIxflUi6kfp3neVJN/QCSWiek05YLzqkik2BG/21+ZbfXd4NeZ MFOt//3BfQt+hlbwWG1Pj9MyfCCmbBr9nIryn7h0BlZ7pQufgM/UJMarY0kunr7wakec Y4H9PnxNIbHjYA9e95JW7SnOitaizPgrYIsWf2q96Mr74osX+o2uT3n3KV03x+iARpyT yOTA== 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=0WhJ9p9SVXNUn4gVPFNc+7lhhnxR29ZXe6fTTMB3jgM=; b=Y8U7QRehxz9mz1E5b1lkIPOE59o6yGxmZxFACIBw06/Ga5vrb97x3RM9vQBr4DGmR8 JA4yVlSFi12L8JaZuza43yOoSP0OeoaW3Y69CBYGXh9xCojRSIN2ZinmkphwULpCaoym HJThGqseKPOfkYobrs2+7yOe91idQyBb9PSHRfJleaZdguSj9Achsi40swUmE9zJ36Kv LcmM+3ShkVaPyVSgAEMlcgrNIskQtkJWo/B+vqRUQ+33eLzxpBkFdf4Y0P+rMLj+iwA3 UfxC3Hz4NMSsvtUoR3el7kbDJPrugSkmsoZHlSeWJx28PJkCG9cqgt2GV4zHnx/1Fxys HTag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DVQlNSoO; 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 e15-20020a50fb8f000000b00457c8bad864si6267922edq.452.2022.10.16.09.52.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Oct 2022 09:52:45 -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=DVQlNSoO; 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 488D938582A1 for ; Sun, 16 Oct 2022 16:52:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 488D938582A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665939164; bh=0WhJ9p9SVXNUn4gVPFNc+7lhhnxR29ZXe6fTTMB3jgM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=DVQlNSoOrX4Vc+aQ4+nMxtZ8aZXfN9Z9uyiT+gTNFBgtXzPCpBfgb8TWSexD2MiQ/ BzJ0wl9yobNCHSSq3NrdOvg3fUObY97eD84vzNx9Qm4FxaTHIRJ6DbHjSUiRa9Vst1 tvLnbVmN25sniR3JOVTdxA/P+m/ZjZqBnxYDMGvs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id EB4283858D3C for ; Sun, 16 Oct 2022 16:51:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB4283858D3C Received: by mail-pl1-x635.google.com with SMTP id o21so6434861ple.5 for ; Sun, 16 Oct 2022 09:51:57 -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=qiPtLmkyL+1MF2tQ2O3kZKnTHUFyv+gAjmeoJJsCwis=; b=ddAXrq3Fcaj+LfbQCtMCqfK6+5IxLZFfJrEVAMtnCeorer5627YIzwFOm8+94yUYcF iY9xUntAI72R6EKKiKfAGONMb3x7jgcjxz+IFcA23vqPVGuVRMBwvhSlK249oAIG4LFd rBK5NZ1XUwey/z6Tm6htvuozUmTbtalLoPeQHTe2FCdZ7TvhFZv3SEzrUr8Ae2Zqx4/i 1eqms2ntkSl9ECnj8zNxR5JHb9HaJJeask4UbRJHImMoqrrS60WUbdvsHUOIqOCmjP/J DniO3/UWYgTnf0wKUDZ92B6sn3MZU3W2Wc/Sn97RlPNWCTrvvv/uV25J2THJMPXsfsjp SR4Q== X-Gm-Message-State: ACrzQf3vYiJf4z2vSSSI8/VzNm0aEbt2PBleqVzBtZkVQ9wmZWWaoo60 SdWCAKnrHoUjGZENR/5Xj1vUvY8Ua4w= X-Received: by 2002:a17:90b:1b0b:b0:20d:7c31:e75d with SMTP id nu11-20020a17090b1b0b00b0020d7c31e75dmr8859694pjb.101.1665939116088; Sun, 16 Oct 2022 09:51:56 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id m8-20020a170902db0800b00183c6784704sm4998894plx.291.2022.10.16.09.51.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Oct 2022 09:51:54 -0700 (PDT) Message-ID: <11801f7f-028c-a2b4-409d-16bfafccde01@gmail.com> Date: Sun, 16 Oct 2022 10:51:52 -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 new constraints for upcoming autoinc fixes on the 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, HTML_MESSAGE, 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-Content-Filtered-By: Mailman/MimeDel 2.1.29 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?1746863826160070745?= X-GMAIL-MSGID: =?utf-8?q?1746863826160070745?= GCC does not allow a the operand of an autoinc addressing mode to overlap with another soure operand in the same insn.  This is primarly enforced with insn conditions.  However, cases can slip through LRA and reload.  To address those scenarios we'll take an idea from the pdp11 port for describing the restriction in constraints as well. To implement that we need register classes and constraints which are "all general purpose hardware registers except r0".  And similarly for r1..r7(sp). This patch adds those register classes and constraints, but does not yet use them. Pushed to the trunk. Jeff commit 6366e3e8847af98d4728d55951534769d034d02a Author: Jeff Law Date: Sun Oct 16 12:43:25 2022 -0400 Add new constraints for upcoming autoinc fixes GCC does not allow a the operand of an autoinc addressing mode to overlap with another soure operand in the same insn. This is primarly enforced with insn conditions. However, cases can slip through LRA and reload. To address those scenarios we'll take an idea from the pdp11 port for describing the restriction in constraints as well. To implement that we need register classes and constraints which are "all general purpose hardware registers except r0". And similarly for r1..r7(sp). This patch adds those register classes and constraints, but does not yet use them. gcc/ * config/h8300/constraints.md (Z0..Z7): New register constraints. * config/h8300/h8300.h (reg_class): Add new classes. (REG_CLASS_NAMES): Similarly. (REG_CLASS_CONTENTS): Similarly. diff --git a/gcc/config/h8300/constraints.md b/gcc/config/h8300/constraints.md index f71996c5f38..6eaffc16975 100644 --- a/gcc/config/h8300/constraints.md +++ b/gcc/config/h8300/constraints.md @@ -216,3 +216,28 @@ (and (match_test "TARGET_H8300SX") (match_code "mem") (match_test "CONSTANT_P (XEXP (op, 0))"))) + +(define_register_constraint "Z0" "NOT_R0_REGS" + "@internal") + +(define_register_constraint "Z1" "NOT_R1_REGS" + "@internal") + +(define_register_constraint "Z2" "NOT_R2_REGS" + "@internal") + +(define_register_constraint "Z3" "NOT_R3_REGS" + "@internal") + +(define_register_constraint "Z4" "NOT_R4_REGS" + "@internal") + +(define_register_constraint "Z5" "NOT_R5_REGS" + "@internal") + +(define_register_constraint "Z6" "NOT_R6_REGS" + "@internal") + +(define_register_constraint "Z7" "NOT_SP_REGS" + "@internal") + diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 9a6c78cf2d5..45cc4fc7796 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -282,6 +282,8 @@ extern const char * const *h8_reg_names; enum reg_class { NO_REGS, COUNTER_REGS, SOURCE_REGS, DESTINATION_REGS, + NOT_R0_REGS, NOT_R1_REGS, NOT_R2_REGS, NOT_R3_REGS, + NOT_R4_REGS, NOT_R5_REGS, NOT_R6_REGS, NOT_SP_REGS, GENERAL_REGS, MAC_REGS, ALL_REGS, LIM_REG_CLASSES }; @@ -291,6 +293,8 @@ enum reg_class { #define REG_CLASS_NAMES \ { "NO_REGS", "COUNTER_REGS", "SOURCE_REGS", "DESTINATION_REGS", \ + "NOT_R0_REGS", "NOT_R1_REGS", "NOT_R2_REGS", "NOT_R3_REGS", \ + "NOT_R4_REGS", "NOT_R5_REGS", "NOT_R6_REGS", "NOT_SP_REGS", \ "GENERAL_REGS", "MAC_REGS", "ALL_REGS", "LIM_REGS" } /* Define which registers fit in which classes. @@ -302,6 +306,14 @@ enum reg_class { {0x010}, /* COUNTER_REGS */ \ {0x020}, /* SOURCE_REGS */ \ {0x040}, /* DESTINATION_REGS */ \ + {0x0fe}, /* NOT_R0_REGS */ \ + {0x0fd}, /* NOT_R1_REGS */ \ + {0x0fb}, /* NOT_R2_REGS */ \ + {0x0f7}, /* NOT_R3_REGS */ \ + {0x0ef}, /* NOT_R4_REGS */ \ + {0x0df}, /* NOT_R5_REGS */ \ + {0x0bf}, /* NOT_R6_REGS */ \ + {0x07f}, /* NOT_SP_REGS */ \ {0xeff}, /* GENERAL_REGS */ \ {0x100}, /* MAC_REGS */ \ {0xfff}, /* ALL_REGS */ \