From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2071.outbound.protection.outlook.com [40.107.247.71]) by sourceware.org (Postfix) with ESMTPS id 2ED7A3858C2C for ; Thu, 2 Nov 2023 16:39:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2ED7A3858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2ED7A3858C2C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.247.71 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1698943164; cv=pass; b=CtrFM37FAp4HoxBIWEeVXL1EK63zTVvdYNFQ9R2JNd2WbPW2M1FeFAlfPBOfg03M5htG1W7jFrV/GlYB/EmmibugUKCt3xR3fz093oLFjqc0gUd6ipAslGNLE5ElTpZJpzLBKjtC44h8GzOpH3tFm70myNhYIBZv4vdAqEEgQsk= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1698943164; c=relaxed/simple; bh=Hno1oAwBD0L3AUs8OXxssHMqIBQUV/ettkr+IYSstqk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=WzYV/PoWfVhkVu3YaNkSv5DT2fxiPzDA86tlMMLWw7m7ghXJjVwgv8qjeI3EO8NufcJq9ZSVeeJYxc9W9hcYZqrUVtg50+ljiPT6lF7uhPcESS+BQnfx1S+nEvrFcXIP4P7FE2EfmkPHtBPOQ7xvWfG0ZHNyvKuth/QYgu28bM0= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=PJA98+yPXhNPH7oy4VcT6fX0SBr6hKEmWAUAuUcUeT3G1Wi94TmHy31rcjHg8ma1pAOCFiutgw1RsFscxgYUhoQtJXwqIqwK7rRX2PfyZagGK6CR77FqczHAuiO6yf4p/dEHyIn+RgYNE0nREVL8leqJXXAtD4ndhfxm7QnIxMoM913JK4OQg2PQufTn6RyaeG6cVoIftZ5uHVtxmSqh+BDlDm0PIw9tTRW0WQ783fzX8IMeFRTrmI5Qq0G/6W6CHL5EzVuGzj/xWUvI5XTozHPqydizHcJgszsPu70dMlUuRfcp7xRDl4jBAVXnw8LXLqIvq+diTaO7u2RfDLH3XA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3vNqS5qD09KPnjxsVwBZBmpSWVpvvRZxiRVH8xSkZn0=; b=fkJFt1e+IsyvfhD024LAM5zdXR9zFtg0zBMxqfDXWB+MK1O5OVfkjdGux2dvJ08+tvQikGbvM1zbRcmxe79FDssx4Yn7adJUVJ0VIBngK1e78QDk3qlDVzzVqfFgC/BfQDXZlsjsLpqWqVLOhxQqNsvR9JnYauREw841Zc/oT+8fZU4ta+q/jtxymUYj0Qe/sfjDCjLbDe/xiChM840nj9jhR2LZulcIxShOrsfR7WFaqVLHRWsGKPnRzRIYPnkhNsaCDIZmoWFTAgnEYXapQwnSn2xSLIrgp80INaOYU/0CsoUF4FuCWQcsqeXJRzBJLVhWeMy15m55q1pQHjXRJg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3vNqS5qD09KPnjxsVwBZBmpSWVpvvRZxiRVH8xSkZn0=; b=vMXZUcrOW2053PF0Ua1A3YB1wI5yZXV9Vi0jLkQCKa82PS0ozQHWRh0uKyTXsvdUJN1kSPy41Druxue/FeUVrXZW4qRaK1jNvpMBkQmmBIcrFSnO+f4oJmSpEpFaF44QYEVsZB3Y6VwVJA6Lbu9OpCFgamVkZ3XQssuIN3PE09g= Received: from AS9PR05CA0154.eurprd05.prod.outlook.com (2603:10a6:20b:496::13) by VE1PR08MB5661.eurprd08.prod.outlook.com (2603:10a6:800:1b3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29; Thu, 2 Nov 2023 16:39:17 +0000 Received: from AMS1EPF00000049.eurprd04.prod.outlook.com (2603:10a6:20b:496:cafe::6d) by AS9PR05CA0154.outlook.office365.com (2603:10a6:20b:496::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 16:39:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS1EPF00000049.mail.protection.outlook.com (10.167.16.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 16:39:17 +0000 Received: ("Tessian outbound 5d213238733f:v228"); Thu, 02 Nov 2023 16:39:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9dac24658eb8aa3b X-CR-MTA-TID: 64aa7808 Received: from 0ef020fcc413.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 11B89FA0-D539-4F48-8092-0AC635554565.1; Thu, 02 Nov 2023 16:39:10 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0ef020fcc413.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 02 Nov 2023 16:39:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HA08bKopmXr++vYSsLlLQaI1hLiWChzTo5/Sf5TeszAY+4HjozahpioIcm7mc8iKKQaQY3V3Ej6av7igp4630cO2u/6//rQjq2bDTwS9rpWXfEe+GV+VDvGzJfM0IXo03ubh8bDYvb1els4gF+6oM12dPqHxvJIyN5eMQincvYZ8dLBgG8kruvj4B6FwCKAxwn4dZci+yAX28EH2ZZmBooj6ZbzzvOmrxnpbxtS9SQ8c5tt6UfnMRKLrhXDWDBcgVzankibhXiOVIkK4x/ZyehSylgDInYHV6jUukpJ2hgoSuQ4MgSnKFT5bad4x7b1iipVKjk/FMQuNs5NCK6vEJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3vNqS5qD09KPnjxsVwBZBmpSWVpvvRZxiRVH8xSkZn0=; b=ccNRqtWv+iExD2Zl+z6XuRa/kWTjVt5rV4e9t4BOBAKvAhGUDnrazM2pcqkSCQKKxAdtRQ0rUIjt06bqlHQMsok5V+Ibw2X0WX3HMQ9O5BO3uQFLbGIkLewm63lqjgmfWdAmZcxgK4TsuGc7nXIGjBt/oHehUPKICyq8c3h6rAGmDlhOBWm432K3Ia+BGa6S5Xly8Hbo4v09VmyrcMmzFzbC5HgWAb+gZQi2XPvldTmxxYZeGy84T4XRtsKiPSeaugx0ueCVYJqp2UZwjDP5Ex1J5yXRuDAfTd4bwDoz+dBjnqj1YjceVIL6GUvSeiQAmTZdpxs2UfPDu6wlkC8Eyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3vNqS5qD09KPnjxsVwBZBmpSWVpvvRZxiRVH8xSkZn0=; b=vMXZUcrOW2053PF0Ua1A3YB1wI5yZXV9Vi0jLkQCKa82PS0ozQHWRh0uKyTXsvdUJN1kSPy41Druxue/FeUVrXZW4qRaK1jNvpMBkQmmBIcrFSnO+f4oJmSpEpFaF44QYEVsZB3Y6VwVJA6Lbu9OpCFgamVkZ3XQssuIN3PE09g= Received: from DUZPR01CA0107.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::25) by GVXPR08MB10475.eurprd08.prod.outlook.com (2603:10a6:150:152::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29; Thu, 2 Nov 2023 16:39:05 +0000 Received: from DU6PEPF00009525.eurprd02.prod.outlook.com (2603:10a6:10:4bb:cafe::20) by DUZPR01CA0107.outlook.office365.com (2603:10a6:10:4bb::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Thu, 2 Nov 2023 16:39:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DU6PEPF00009525.mail.protection.outlook.com (10.167.8.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 16:39:04 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 2 Nov 2023 16:39:00 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 2 Nov 2023 16:38:59 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Thu, 2 Nov 2023 16:38:59 +0000 From: Victor Do Nascimento To: CC: , , , Victor Do Nascimento Subject: [PATCH V3 6/6] aarch64: Add system register duplication check selftest Date: Thu, 2 Nov 2023 16:38:34 +0000 Message-ID: <20231102163852.1860658-7-victor.donascimento@arm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102163852.1860658-1-victor.donascimento@arm.com> References: <20231102163852.1860658-1-victor.donascimento@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU6PEPF00009525:EE_|GVXPR08MB10475:EE_|AMS1EPF00000049:EE_|VE1PR08MB5661:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bd491f5-13a5-46ee-2721-08dbdbc24170 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: KDasFuc+Vyfv9U1aLURa+/6+B7gwjk+t8PDRvjy6JEEQC1bF5Krbtv31A/816jnyS9QRxZq4dpgvjicGw54AFxFysBMwh11QlQudJuAevOxDlle93AORMHbBOZYhfXwq8dC/bm+m6IOf6OoqYJ0HFfiaZxMqyWWS8zFESKAdYrzahBtJZDmLwmarVQkDssh1qHyQ1cAtvX3PhkOxUkMrwuA5Vqu1U7UKfKSz6i4sHHMXyN8ubX5ROLssB2JQSktHiajlm+Bw/sp+HtPolV1QmB0CFy6qebQ/lT3KWcY6FEZw01eCIVYD6S8SQp7I9mAuHtM0hZHxYXyCIyHE7cs0WQuoMov7502lR67ei4R9xrzbv3u6Nt9SBFvDdIwq1VdGHpW6GIfIU59pagn6Snisd4eOKx5Nn6y/DMG2Bn3+xVDqCtEfk5uekwQh6Hbs5cmcSenWQ2ad6OwSEbfyjkW0D45rIcVMNob175Z2iV9kHKZmhiADo+2dfbZofRFXXLsUOKbHQJdiS9r8LDG5+Bju2A9RAXqnHTUpAhThm3tgvDoYv7wdaLaFvlNnDZH3rDudrX0PipiYKz9NZtAMV+hK/D2oX/xWcN28xm6L8AnQhBmF5ZwzsgC+Yx7+Dlu3QEZZDK2YFMl6eu3NZUyCWdJx+naeR4GLbYjNPCAp+oby5+2udFGX8qyPizHwmu3UEpBGCiigfsYC0mlG3oBHkdMjd92JD9UKuQpeWGpgpJN+L7RjrG9lE0vIKo23Cs9AIckESOTazu6V+T8qWA/u9hWhaw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39850400004)(396003)(376002)(346002)(230922051799003)(1800799009)(64100799003)(82310400011)(186009)(451199024)(36840700001)(40470700004)(46966006)(1076003)(6916009)(316002)(54906003)(41300700001)(70206006)(8936002)(8676002)(70586007)(4326008)(5660300002)(40480700001)(40460700003)(47076005)(82740400003)(356005)(336012)(478600001)(81166007)(426003)(2906002)(83380400001)(7696005)(86362001)(36756003)(26005)(36860700001)(6666004)(2616005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10475 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000049.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 514b91d3-0ec1-4925-e14d-08dbdbc23a03 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 75dLelTHRdx9gfSRf14GMqKLw8gwcb/qxIMTGnwETmdIyQy2uh6OcyISCPp7ibFtcZxgAqnjRmyyofyWaCOAEqcLSUNwtSBqP+uhLrDtniAyIfXU0JARFyIe6T2PrRsjfGQ3Y2RuyR8EzX+uu9h1pszsmq7jOQSPQWm1gqFKjrTSqZStYSdesRkxbS2N1pzeXMUuNTZk5y3zDE2PDGz/DyfLOWnaGC/AEF4zqFuCHgZCsA5WW9CYI7hBsNghPFKYcCOS7cZ00BhJfpYYEuCQAinowoBwdo4RYigTflX+YvEKItbxdFFK1uf4ihmiJky0vq27MSlysYxjZ/++v16ccy9jdeqKKDDvdNe/61Fyv75SAtW1urCKh6XtkEV915wOGGKvizth+bjemp0ACXxenioLvLk+iZUQU7mLvJzKCQTGXfWSDLFRh7V9C/bkuGx1Ji7Z5VhWKhQPhlqSSU9bfAEeEKYk/Ootj1XfYf/nWqmPWhRk7AFl4LgVCFYa2n1SZuv6Z0Vo3ZLygqdXe3c1vqnBq9A75LepPMuNhL6e7qhkdbfBzt2HsAIxg1eF4nrJC9RgLpWwCfCTVLueFcc5zLv8xpXJdphSyNXSZLXKw0e5nyPrFXXCXhAQAxj8pbfBd9IhGmZ/UzEOQ91awo1DhOs1BePQY0VHzOwJDxO3olrgPuBTwrdajEdojA2sbTC7D4ZnN37YTu/8045uCQKCiTRLLYa2o12El9WFs6mRV49FsmrZ5rOjHBFfHIf1vn8S X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(376002)(39850400004)(396003)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(82310400011)(36840700001)(40470700004)(46966006)(47076005)(86362001)(36860700001)(2906002)(5660300002)(6666004)(40480700001)(7696005)(2616005)(1076003)(40460700003)(82740400003)(26005)(54906003)(70586007)(81166007)(6916009)(36756003)(316002)(70206006)(478600001)(83380400001)(8936002)(8676002)(4326008)(426003)(336012)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2023 16:39:17.0595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bd491f5-13a5-46ee-2721-08dbdbc24170 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF00000049.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5661 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Add a build-time test to check whether system register data, as imported from `aarch64-sys-reg.def' has any duplicate entries. Duplicate entries are defined as any two SYSREG entries in the .def file which share the same encoding values (as specified by its `CPENC' field) and where the relationship amongst the two does not fit into one of the following categories: * Simple aliasing: In some cases, it is observed that one register name serves as an alias to another. One example of this is where TRCEXTINSELR aliases TRCEXTINSELR0. * Expressing intent: It is possible that when a given register serves two distinct functions depending on how it is used, it is given two distinct names whose use should match the context under which it is being used. Example: Debug Data Transfer Register. When used to receive data, it should be accessed as DBGDTRRX_EL0 while when transmitting data it should be accessed via DBGDTRTX_EL0. * Register depreciation: Some register names have been deprecated and should no longer be used, but backwards- compatibility requires that such names continue to be recognized, as is the case for the SPSR_EL1 register, whose access via the SPSR_SVC name is now deprecated. * Same encoding different target: Some encodings are given different meaning depending on the target architecture and, as such, are given different names in each of theses contexts. We see an example of this for CPENC(3,4,2,0,0), which corresponds to TTBR0_EL2 for Armv8-A targets and VSCTLR_EL2 in Armv8-R targets. A consequence of these observations is that `CPENC' duplication is acceptable iff at least one of the `properties' or `arch_reqs' fields of the `sysreg_t' structs associated with the two registers in question differ and it's this condition that is checked by the new `aarch64_test_sysreg_encoding_clashes' function. gcc/ChangeLog: * config/aarch64/aarch64.cc (aarch64_test_sysreg_encoding_clashes): New. (aarch64_run_selftests): add call to aarch64_test_sysreg_encoding_clashes selftest. --- gcc/config/aarch64/aarch64.cc | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index eaeab0be436..c0d75f167be 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -22,6 +22,7 @@ #define INCLUDE_STRING #define INCLUDE_ALGORITHM +#define INCLUDE_VECTOR #include "config.h" #include "system.h" #include "coretypes.h" @@ -28390,6 +28391,48 @@ aarch64_test_fractional_cost () ASSERT_EQ (cf (1, 2).as_double (), 0.5); } +/* Calculate whether our system register data, as imported from + `aarch64-sys-reg.def' has any duplicate entries. */ +static void +aarch64_test_sysreg_encoding_clashes (void) +{ + using dup_instances_t = hash_map>; + + dup_instances_t duplicate_instances; + + /* Every time an encoding is established to come up more than once + we add it to a "clash-analysis queue", which is then used to extract + necessary information from our hash map when establishing whether + repeated encodings are valid. */ + + /* 1) Collect recurrence information. */ + for (unsigned i = 0; i < nsysreg; i++) + { + const sysreg_t *reg = sysreg_structs + i; + + std::vector *tmp + = &duplicate_instances.get_or_insert (reg->encoding); + + tmp->push_back (reg); + } + + /* 2) Carry out analysis on collected data. */ + for (auto instance : duplicate_instances) + { + unsigned nrep = instance.second.size (); + if (nrep > 1) + for (unsigned i = 0; i < nrep; i++) + for (unsigned j = i + 1; j < nrep; j++) + { + const sysreg_t *a = instance.second[i]; + const sysreg_t *b = instance.second[j]; + ASSERT_TRUE ((a->properties != b->properties) + || (a->arch_reqs != b->arch_reqs)); + } + } +} + /* Run all target-specific selftests. */ static void @@ -28397,6 +28440,7 @@ aarch64_run_selftests (void) { aarch64_test_loading_full_dump (); aarch64_test_fractional_cost (); + aarch64_test_sysreg_encoding_clashes (); } } // namespace selftest -- 2.41.0