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: 58922 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 1E9A238582A1 for ; Sun, 16 Oct 2022 16:52:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E9A238582A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665939150; bh=0WhJ9p9SVXNUn4gVPFNc+7lhhnxR29ZXe6fTTMB3jgM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QTBSSzvegErOsyJulrgiPYmVz5bNuUoil7yybp7E9v0VTMEssiIPoVykX74tzhaV+ bV+oTGgONZ8ktILxBKqsvhzFt4fT0c3yzTZAVkBN2kRJMRv/Gigw/I7lBeQbNS/Dng Pv5MUo901ePRuXB2jFZQJ4ZWi4TVjmq2aTXSVSxg= 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-Google-Smtp-Source: AMsMyM6djA/vHlE0RNn+J5fZkG4Bp3jCB+F+2JjTg2hyKYvivgPq6BZ21zDVvpxes4UStd4t4DiSRg== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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 */ \