From patchwork Tue Apr 9 15:09:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Ball X-Patchwork-Id: 1921499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=N5TCYfv0; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=N5TCYfv0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VDTsp30D1z1yYT for ; Wed, 10 Apr 2024 01:10:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A43A386F420 for ; Tue, 9 Apr 2024 15:10:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by sourceware.org (Postfix) with ESMTPS id D1C293858431 for ; Tue, 9 Apr 2024 15:09:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1C293858431 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 D1C293858431 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.55 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712675398; cv=pass; b=ZLC5inglREyjMivZmkhS+VYKodCPdLPxOMrZ25P23CjG9587vlvAu3lkgzGKtpPdI6t7zjSqQ8ha0+p2OkyeIal+ao4pblUOoJM4Ml4H4u5tAdhgRkOvwcD14cdwVSq+SbzZWDFx2z+8095jLR0VieKGd95Kd4UC4hHan6ksXcs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712675398; c=relaxed/simple; bh=jB6kXI+YvTXoG1Gd6bughbUbHi4mw1qWB9i4FVoEBxY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:To:From:Subject: MIME-Version; b=W9SrDBvnj0XujjtQbH8P86k7HvaiU39acc2pBI438z+zQTUwe7UC0xStnLu44V8oN5SI88cFtTGj9AvVhzRWfCEJZ1LnILiqT64+RhOZmQxDvlHCUMrFsNAdXowDtmGreJ9R9kdlXd8fzYrwH/chCKbHkeAVbPWtj6are/yTVS4= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=FapipAP7+CmI2qtM97w/F70v9CmLZRu479ClcwALIWnp3i013C52MGnYLhsHpZWrxRqpcvJRLmEWdyjOXUcH9OzEbR8iaW9vyx2ssBdtwWfdo0eQS7sgo9PLD9kG2/al5aX2QxpaJ09JWUCo4eFD0Jn6jARRYs7IzG2/g5vi477clDWO4qiTQ16NmCqPXeg4tRpj9hvZN9vVxgLs8TnTrV+U5uixNTtKPlFl1CjM8Y3zvR9JPsaGQ48wzrARU3NcWbwkgvq0ASeRMyWmw95OMbTKu88e7ImSsT8scpJqvRWV9dzfIrcvtqJc+pkOSPZYoeLA0gBhOZZSdVoGz0s9ew== 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=WwzuW72Dxa1WIqV4Tceoh4mZ2IjW8imRTlqlrd4VkWI=; b=WHvnCmTtbrwlpbdydNHNsCJ+5o6eE6oAmlQjwAWa+PkQeJW+d7XxUEH51O8b4AyaZKh/MlVp6nSmdBD/xXtMx+yhKdntSRnFjxp/cTAXG/yUGrG0wh9asH2P1otoZmmBEzKgbw54CKSBl1wYJgs/wBG0AyZljMZUZZZuZoSkpDwWN5ypveNMqRQIDokRE0Z59Bb7Su7WCKh50TGQgfzR85C4RGNwNCTSvZVeWHm5hS+s5QZR6gQ58h4exdqjnXz7+MtlmfPY7wX22NM9SCBdvsHAUBcD/zqrn6JLSfBMcf318UNHmplqb1+OE8o50tmWVKWSZCqgLincFUGVPT8B6A== 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] dkim=[1,1,header.d=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=WwzuW72Dxa1WIqV4Tceoh4mZ2IjW8imRTlqlrd4VkWI=; b=N5TCYfv0FsGx9nxeP5EtILBEwrQ5JWGwClEr6iziQske0KIeHbntdZPB2kjK65OtRT0lmslG0ypkXrlZjPXvrBXg3ddJtvjLe4OdPy3V2ERayli5mBNTvjrM/p1yaq9AwV+8xmnvPgGK6YrX5J4h9ufuUxiNnPT/M3ljJBqCFFs= Received: from AS9PR04CA0082.eurprd04.prod.outlook.com (2603:10a6:20b:48b::6) by GVXPR08MB10725.eurprd08.prod.outlook.com (2603:10a6:150:158::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.45; Tue, 9 Apr 2024 15:09:53 +0000 Received: from AMS0EPF000001A5.eurprd05.prod.outlook.com (2603:10a6:20b:48b:cafe::fa) by AS9PR04CA0082.outlook.office365.com (2603:10a6:20b:48b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.36 via Frontend Transport; Tue, 9 Apr 2024 15:09:53 +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 AMS0EPF000001A5.mail.protection.outlook.com (10.167.16.232) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Tue, 9 Apr 2024 15:09:53 +0000 Received: ("Tessian outbound dc0a9029eb2c:v300"); Tue, 09 Apr 2024 15:09:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1b894f4a5983fa2e X-CR-MTA-TID: 64aa7808 Received: from f88370092ffd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D90490E3-16A5-4AFC-BA00-30DC62F76660.1; Tue, 09 Apr 2024 15:09:46 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f88370092ffd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 09 Apr 2024 15:09:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lNKXeEVsIXNr3/zIwbHMOV0YuErEr0k6Q/qC0PKpougb6j9wivOzTFcwG6DaNmHJUvlHwTw5mlG9Mche8B+mqCk9WaEBChwB76NBpHv2Q6KGsm3xjX9I8Wrp+4TfxjxH3sKWzjW1Qk+PRFHEmYIDxTUL2/xzOGzA+SVN7H1qWhQDMvW5GZPIun2j8cGhw+91azi+S1MfyGr7nhvuGk7xU7s1D+UEtVzIgvo8kG7+mJA7EdhQeHCU3h+1vY+q/Ppb5ZRY1uiR686MaisDIldO1lo9SSaPkzdh5vAShe0MabfVXl5wnoCsuF+Pb/IcUoQPxVCQ7f/MOdWMKSAvKBVChA== 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=WwzuW72Dxa1WIqV4Tceoh4mZ2IjW8imRTlqlrd4VkWI=; b=LKnL97hjOCvs8h9n4+zgKGTgrpDtuhXNYZ+O+7bmkABNXtzWuAF0H4RI+YLuoUjoSc+sEPfRZ/zGRJZv7PvH1HCZOXflIXBoV7ooO/qqIazLeQ3zfnmoIUkJzp9hkIDKwTckC3+CDWtng7uaf4l83lMKHVFNK+smY3vgWc4c/9jpQ5+5nqC7BZNLwfqMBycFnLNJGOafy/6Pe/qQOmYInG5Iy0r+xQUUSmsSQQ2jHZKXirZEQhFkNmioQvU7sIvy9xZYKEczhXzYfNgZuSmaS8SOYreh+GaOHtdhsO2DokjfBvRP7pGHbQ/4wi4DjpRRqSZ2xMjhOS9ZmKD5QwmXmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none 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=WwzuW72Dxa1WIqV4Tceoh4mZ2IjW8imRTlqlrd4VkWI=; b=N5TCYfv0FsGx9nxeP5EtILBEwrQ5JWGwClEr6iziQske0KIeHbntdZPB2kjK65OtRT0lmslG0ypkXrlZjPXvrBXg3ddJtvjLe4OdPy3V2ERayli5mBNTvjrM/p1yaq9AwV+8xmnvPgGK6YrX5J4h9ufuUxiNnPT/M3ljJBqCFFs= Received: from DB9PR08MB6957.eurprd08.prod.outlook.com (2603:10a6:10:2bc::10) by DU0PR08MB9902.eurprd08.prod.outlook.com (2603:10a6:10:476::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Tue, 9 Apr 2024 15:09:44 +0000 Received: from DB9PR08MB6957.eurprd08.prod.outlook.com ([fe80::5c14:ca3c:588b:1b39]) by DB9PR08MB6957.eurprd08.prod.outlook.com ([fe80::5c14:ca3c:588b:1b39%5]) with mapi id 15.20.7409.042; Tue, 9 Apr 2024 15:09:43 +0000 Message-ID: <5c8952f3-f6f1-417f-954b-862b28a0c224@arm.com> Date: Tue, 9 Apr 2024 16:09:40 +0100 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Sandiford , Richard Earnshaw From: Richard Ball Subject: [PATCH v2] aarch64: Fix ACLE SME streaming mode error in neon-sve-bridge X-ClientProxiedBy: LO4P123CA0645.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:296::16) To DB9PR08MB6957.eurprd08.prod.outlook.com (2603:10a6:10:2bc::10) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB6957:EE_|DU0PR08MB9902:EE_|AMS0EPF000001A5:EE_|GVXPR08MB10725:EE_ 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: iuIatIZCcCseZRiFOpjqM4NPXQE7Vs2ky6pxr9J+c6iFaSqYAoASl2XI9g7XZ/8zhUlj8VKUwmdiISfmXwTQkOBHg74XTy88fXvjGiMzOx3fRPxKO11o0bk5J4ALfRRcycmQrVj/jN2wlqbgT39ViL3sb7JVzHDRiDb4Omvh8FqKxibqTLoyyFqe3PC2VmfoFrlWle749SX6QSZ8voKHeftCAoHaj3Rd0AhB4nGphX+G/pwXyPVPtd6wzoXXjhZYJIvBgiVdBlU4DhU+ZQ7lVZv8aHk5OcLIRoA88i36HiS6bHtpwwhm9SQl0hwgtzDoEe2u/3dOhl8eiRsvYvJU6jJE6Sup7hBwXk4DHaV8+a65H8AXuhnL82y6v01qX01NXWe0I6fsFG1G36m+Q4n6pi2exNhBaJXiKPg3NUPuSb4AIpuBFRdQo3Cf3UiAJg8OvuePsEex6BxxfD01xXUuX5IYCLDc0HujXyZhnBt9ftftAWIgPPWsJiyDpS2PHq5uf9bozonvbtlCgIyMzY8Gsk7EVfv1Ky64/W0wyrGsRwdP1vSraASGoC5FR4VTg1pKLAAOAnMLdLbXMRMedK/6LpVtB2iavbEyjnSnm+VK4ErKYDxTsxOzz9xCmQlkYoifdM7x6dYc/4DVLXe/K/0ILhtcu9g7gBZySrfocBT/fVI= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB6957.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(366007)(376005); DIR:OUT; SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9902 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A5.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8647d4e9-e1f9-4806-228d-08dc58a71bef X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4ESWjnJEAHF6zltrZD/1yWQnTJw3acoIsOEk+reOyrC1/6ZpzCQVXO73opJXdjY+OaAcsOP8g+TPiJszGnbaVNgZryBq9q22jk4C35AtJzZgqye3+A4rpDD8E7ZH05FYqlZiW3us+ZlldBE//BnJVG4d13GKUVOCUsnOPt6PORLQ3VPCEJkYUAtqzMxA85oB8LGuf4bZ7myu90+B71jc6gs5ECgBjzwCXxaYdyWpN+X4F0M8djKeRo6WW66uLeZj0lGbwVXMoDKOWyvVrju83PdUmCM/lBZi83Hq/aE5wV/508SRulwqabQQa9HvAhdfIJGOMEbCMqFfFAvvTNh7tcIATCPlSkCrLtdc5NTFRMdfO4RFd5An/f17Bq8EIdKAvdCBBpFGLNqm2noCl2u3FQBTNUzkls3c9vuK2DYev7cfb5xqeD1yVTzQRkd9KrilqAfvBupUVZOsY26nFuEPkOmPoWjWmlGj0IBUMfEoiY+QbEdTHFDSunfd51kQhobxO65lmbnXWkowsMUFAbKK8gomIkqcCq2sgaEo+pERplzLoJF5JVV4CzRFOarOvhuRLCBML7b/9VTbNTYJZvWw39ePvsRi2Ciak5C7jDqc5F2GZeiqK27Pehfe3/FvdKuWLyOAmcCiNTNLkOFX6SIapcOJYeROVgQwzROtYtb8ctEIxBkUVuBjDlAtCXwaUbfpljQaXCR6L/OzwNsimR+QSeYfWe94kx03CVYfamoI56ZNGpR4dlcXlMbV2kuwrUuH 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)(376005)(82310400014)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2024 15:09:53.0582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8647d4e9-e1f9-4806-228d-08dc58a71bef 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: AMS0EPF000001A5.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10725 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_LOTSOFHASH, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org When using LTO, handling the pragma for sme before the pragma for the neon-sve-bridge caused the following error on svset_neonq, in the neon-sve-bridge.c test. error: ACLE function '0' can only be called when SME streaming mode is enabled. This has been resolved by changing the pragma handlers to accept two modes. One where they add functions normally and a second in which registered_functions is filled with a placeholder value. By using this, the ordering of the functions can be maintained. No regressions on aarch64-none-elf. gcc/ChangeLog: * config/aarch64/aarch64-c.cc (aarch64_pragma_aarch64): Add functions_nulls parameter to pragma_handlers. * config/aarch64/aarch64-protos.h: Likewise. * config/aarch64/aarch64-sve-builtins.h (enum handle_pragma_index): Add enum to count number of pragmas to be handled. * config/aarch64/aarch64-sve-builtins.cc (GTY): Add global variable for initial indexes and change overload_names to an array. (function_builder::function_builder): Add pragma handler information. (function_builder::add_function): Add code for overwriting previous registered_functions entries. (add_unique_function): Use an array to register overload_names for both pragma handler modes. (add_overloaded_function): Likewise. (init_builtins): Add functions_nulls parameter to pragma_handlers. (handle_arm_sve_h): Initialize pragma handler information. (handle_arm_neon_sve_bridge_h): Likewise. (handle_arm_sme_h): Likewise. diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index b5a6917d06db41a845681ed6f13f2800c70ede10..fe1a20e4e546a68e5f7eddff3bbb0d3e831fbd9b 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -344,15 +344,15 @@ aarch64_pragma_aarch64 (cpp_reader *) const char *name = TREE_STRING_POINTER (x); if (strcmp (name, "arm_sve.h") == 0) - aarch64_sve::handle_arm_sve_h (); + aarch64_sve::handle_arm_sve_h (false); else if (strcmp (name, "arm_sme.h") == 0) - aarch64_sve::handle_arm_sme_h (); + aarch64_sve::handle_arm_sme_h (false); else if (strcmp (name, "arm_neon.h") == 0) handle_arm_neon_h (); else if (strcmp (name, "arm_acle.h") == 0) handle_arm_acle_h (); else if (strcmp (name, "arm_neon_sve_bridge.h") == 0) - aarch64_sve::handle_arm_neon_sve_bridge_h (); + aarch64_sve::handle_arm_neon_sve_bridge_h (false); else error ("unknown %<#pragma GCC aarch64%> option %qs", name); } diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index bd719b992a545630f9ad6a73753fad55c6ac5d7e..42639e9efcf1e0f9362f759ae63a31b8eeb0d581 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -1014,9 +1014,9 @@ bool aarch64_general_check_builtin_call (location_t, vec, namespace aarch64_sve { void init_builtins (); - void handle_arm_sve_h (); - void handle_arm_sme_h (); - void handle_arm_neon_sve_bridge_h (); + void handle_arm_sve_h (bool); + void handle_arm_sme_h (bool); + void handle_arm_neon_sve_bridge_h (bool); tree builtin_decl (unsigned, bool); bool builtin_type_p (const_tree); bool builtin_type_p (const_tree, unsigned int *, unsigned int *); diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h index e66729ed63532811b3b16ab57ae11cb10518caca..3e0d2b8560c538d201c97fba3591ddf9893d664a 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.h +++ b/gcc/config/aarch64/aarch64-sve-builtins.h @@ -123,6 +123,15 @@ enum units_index UNITS_vectors }; +/* Enumerates the pragma handlers. */ +enum handle_pragma_index +{ + arm_sve_handle, + arm_sme_handle, + arm_neon_sve_handle, + NUM_PRAGMA_HANDLERS +}; + /* Describes the various uses of a governing predicate. */ enum predication_index { @@ -419,7 +428,7 @@ class registered_function; class function_builder { public: - function_builder (); + function_builder (handle_pragma_index, bool); ~function_builder (); void add_unique_function (const function_instance &, tree, @@ -453,6 +462,12 @@ private: /* Used for building up function names. */ obstack m_string_obstack; + + /* Used to store the index for the current function. */ + unsigned int m_function_index; + + /* Stores the mode of the current pragma handler. */ + bool m_function_nulls; }; /* A base class for handling calls to built-in functions. */ diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 11f5c5c500c8331094933cb1c1205a1360eca79b..924bfeb3e23bb1bbed79d36adf33286b87b52f85 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -933,14 +933,19 @@ tree acle_svprfop; /* The list of all registered function decls, indexed by code. */ static GTY(()) vec *registered_functions; +/* Stores the starting function index for each pragma handler. */ +static unsigned int initial_indexes[NUM_PRAGMA_HANDLERS]; + /* All registered function decls, hashed on the function_instance that they implement. This is used for looking up implementations of overloaded functions. */ static hash_table *function_table; -/* Maps all overloaded function names that we've registered so far to - their associated function_instances. The map keys are IDENTIFIER_NODEs. */ -static GTY(()) hash_map *overload_names; +/* Index 0 maps all overloaded function names that we've registered so far to + their associated function_instances. Index 1 does the same for functions + that we've skipped over without registering. In both cases, the map keys + are IDENTIFIER_NODEs. */ +static GTY(()) hash_map *overload_names[2]; /* True if we've already complained about attempts to use functions when the required extension is disabled. */ @@ -1332,10 +1337,21 @@ sve_switcher::~sve_switcher () maximum_field_alignment = m_old_maximum_field_alignment; } -function_builder::function_builder () +function_builder::function_builder (handle_pragma_index pragma_index, + bool function_nulls) { m_overload_type = build_function_type (void_type_node, void_list_node); m_direct_overloads = lang_GNU_CXX (); + + if (initial_indexes[pragma_index] == 0) + { + unsigned int index = vec_safe_length (registered_functions); + initial_indexes[pragma_index] = index; + } + + m_function_index = initial_indexes[pragma_index]; + m_function_nulls = function_nulls; + gcc_obstack_init (&m_string_obstack); } @@ -1499,9 +1515,8 @@ function_builder::add_function (const function_instance &instance, bool overloaded_p, bool placeholder_p) { - unsigned int code = vec_safe_length (registered_functions); - code = (code << AARCH64_BUILTIN_SHIFT) | AARCH64_BUILTIN_SVE; - + unsigned int length = vec_safe_length (registered_functions); + unsigned int code = (m_function_index << AARCH64_BUILTIN_SHIFT) | AARCH64_BUILTIN_SVE; /* We need to be able to generate placeholders to enusre that we have a consistent numbering scheme for function codes between the C and C++ frontends, so that everything ties up in LTO. @@ -1515,7 +1530,7 @@ function_builder::add_function (const function_instance &instance, nodes and remove the target hook. For now, however, we need to appease the validation and return a non-NULL, non-error_mark_node node, so we arbitrarily choose integer_zero_node. */ - tree decl = placeholder_p + tree decl = placeholder_p || m_function_nulls ? integer_zero_node : simulate_builtin_function_decl (input_location, name, fntype, code, NULL, attrs); @@ -1525,7 +1540,11 @@ function_builder::add_function (const function_instance &instance, rfn.decl = decl; rfn.required_extensions = required_extensions; rfn.overloaded_p = overloaded_p; - vec_safe_push (registered_functions, &rfn); + if (m_function_index >= length) + vec_safe_push (registered_functions, &rfn); + else + (*registered_functions)[m_function_index] = &rfn; + m_function_index++; return rfn; } @@ -1554,11 +1573,14 @@ add_unique_function (const function_instance &instance, required_extensions, false, false); /* Enter the function into the hash table. */ - hashval_t hash = instance.hash (); - registered_function **rfn_slot - = function_table->find_slot_with_hash (instance, hash, INSERT); - gcc_assert (!*rfn_slot); - *rfn_slot = &rfn; + if (!m_function_nulls) + { + hashval_t hash = instance.hash (); + registered_function **rfn_slot + = function_table->find_slot_with_hash (instance, hash, INSERT); + gcc_assert (!*rfn_slot); + *rfn_slot = &rfn; + } /* Also add the function under its overloaded alias, if we want a separate decl for each instance of an overloaded function. */ @@ -1589,12 +1611,13 @@ function_builder:: add_overloaded_function (const function_instance &instance, aarch64_feature_flags required_extensions) { - if (!overload_names) - overload_names = hash_map::create_ggc (); + auto &name_map = overload_names[m_function_nulls]; + if (!name_map) + name_map = hash_map::create_ggc (); char *name = get_name (instance, true); tree id = get_identifier (name); - if (registered_function **map_value = overload_names->get (id)) + if (registered_function **map_value = name_map->get (id)) gcc_assert ((*map_value)->instance == instance && ((*map_value)->required_extensions & ~required_extensions) == 0); @@ -1603,7 +1626,7 @@ add_overloaded_function (const function_instance &instance, registered_function &rfn = add_function (instance, name, m_overload_type, NULL_TREE, required_extensions, true, m_direct_overloads); - overload_names->put (id, &rfn); + name_map->put (id, &rfn); } obstack_free (&m_string_obstack, name); } @@ -4510,9 +4533,9 @@ init_builtins () register_builtin_types (); if (in_lto_p) { - handle_arm_sve_h (); - handle_arm_sme_h (); - handle_arm_neon_sve_bridge_h (); + handle_arm_sve_h (false); + handle_arm_sme_h (false); + handle_arm_neon_sve_bridge_h (false); } } @@ -4614,7 +4637,7 @@ register_svprfop () /* Implement #pragma GCC aarch64 "arm_sve.h". */ void -handle_arm_sve_h () +handle_arm_sve_h (bool function_nulls_p) { if (function_table) { @@ -4641,17 +4664,20 @@ handle_arm_sve_h () /* Define the functions. */ function_table = new hash_table (1023); - function_builder builder; + function_builder builder (arm_sve_handle, function_nulls_p); for (unsigned int i = 0; i < ARRAY_SIZE (function_groups); ++i) builder.register_function_group (function_groups[i]); } /* Implement #pragma GCC aarch64 "arm_neon_sve_bridge.h". */ void -handle_arm_neon_sve_bridge_h () +handle_arm_neon_sve_bridge_h (bool function_nulls_p) { + if (initial_indexes[arm_sme_handle] == 0) + handle_arm_sme_h (true); + /* Define the functions. */ - function_builder builder; + function_builder builder (arm_neon_sve_handle, function_nulls_p); for (unsigned int i = 0; i < ARRAY_SIZE (neon_sve_function_groups); ++i) builder.register_function_group (neon_sve_function_groups[i]); } @@ -4668,7 +4694,7 @@ builtin_decl (unsigned int code, bool) /* Implement #pragma GCC aarch64 "arm_sme.h". */ void -handle_arm_sme_h () +handle_arm_sme_h (bool function_nulls_p) { if (!function_table) { @@ -4677,17 +4703,9 @@ handle_arm_sme_h () return; } - static bool initialized_p; - if (initialized_p) - { - error ("duplicate definition of %qs", "arm_sme.h"); - return; - } - initialized_p = true; - sme_switcher sme; - function_builder builder; + function_builder builder (arm_sme_handle, function_nulls_p); for (unsigned int i = 0; i < ARRAY_SIZE (sme_function_groups); ++i) builder.register_function_group (sme_function_groups[i]); }