From patchwork Mon Mar 8 10:57:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1448983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=vu2PwT9Q; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DvFg12TMVz9sW5 for ; Mon, 8 Mar 2021 21:57:47 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7381B3894C1B; Mon, 8 Mar 2021 10:57:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7381B3894C1B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1615201064; bh=fnp4nNZGVT4CTSMLbCaXI7TYGWG9r7YYAc0tylnhyIk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=vu2PwT9QbCDJKvxO3hMehBgaRDEoLO7s1EQ6Kq/QL2ydB3etctydBYzUfoa5wvWmN npgYiPNlhOUUmYjZIVvtKtN4Unj37m7NIvOo3QWVYRcVL10C/qpcrukbI7qBdJTRRt Nsl4NbKcobIXO5j3fLxUaRXifa/LsNANAPx5Skd0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10062.outbound.protection.outlook.com [40.107.1.62]) by sourceware.org (Postfix) with ESMTPS id 4A84B3857807 for ; Mon, 8 Mar 2021 10:57:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4A84B3857807 Received: from DB6PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:4:29::13) by PA4PR08MB6144.eurprd08.prod.outlook.com (2603:10a6:102:e3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Mon, 8 Mar 2021 10:57:33 +0000 Received: from DB5EUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:29:cafe::8a) by DB6PR0202CA0003.outlook.office365.com (2603:10a6:4:29::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 10:57:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT061.mail.protection.outlook.com (10.152.21.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Mon, 8 Mar 2021 10:57:33 +0000 Received: ("Tessian outbound 54df20dfd071:v71"); Mon, 08 Mar 2021 10:57:33 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 16a837617c525abf X-CR-MTA-TID: 64aa7808 Received: from eb52f0639fa1.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1A64A2E8-DB70-43F2-B540-FAFE542A2637.1; Mon, 08 Mar 2021 10:57:24 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id eb52f0639fa1.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 08 Mar 2021 10:57:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SExXFPbgiI/77+GrBrVN+HDFhnfo82WapJFJtnk6maaLs+960HoZoStUlBSky3/Wn69qS+kglghTCXcoe/7dODq86qaExOTFKTvbTHGKZo/hLj2I9dVO6vb8pAMx8KYLs90Zi/IaVaI13fW6qHXV01mGzLGQ3PAdEoKt5enMv5fjuPH0tIqo5xlVxPirey/R2QCPFLokzJ6xATjl33Mup4oKIl6Xzv475lOW9NBw2gxc6LaynOFIv6BK0S0Xw6bVvjvDoh2MBBUJgyU0Ek8XnnffgyO9xTECNiX4EI+8fwHe/SGGIYrY1yqFfoboYMhOTW/iW86rvikc7pvS1yEstQ== 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-SenderADCheck; bh=fnp4nNZGVT4CTSMLbCaXI7TYGWG9r7YYAc0tylnhyIk=; b=ggnkM34G6WtNJ8106gqG1ucFQYncjajztwxKwoPuBaQg0fHCX2S9xrdsS5D5YQKV52q/WEa7jVlCm3+2b2TB5W+nKjdrr1SjBgRfrJ31Mudyww7gblUxpRdDHIuI/zB6JRPHNk7O2Qhj5/8ItypDDvITL6o7H+3NnSwoy2pyaqW2z7scAgF8NX9srl/g8qOOu5LXGoYmsSCUI4K+C0rZzY3bApO1X2UcSWQZOQOMltZMLCTqrvgWd6YdJMwoS9LW5AUPlKj4s6RmpvbSMMZC+QHh6fK8Ux67PtP/FSy8JvjsgB2xd4VtiPIQiTfOjc/jfVctTJHpvr5FMe8R0ZjNNw== 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 Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) by VE1PR08MB5024.eurprd08.prod.outlook.com (2603:10a6:803:106::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.25; Mon, 8 Mar 2021 10:57:14 +0000 Received: from VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2]) by VI1PR08MB4029.eurprd08.prod.outlook.com ([fe80::91e5:a54c:eda6:49b2%4]) with mapi id 15.20.3912.027; Mon, 8 Mar 2021 10:57:14 +0000 Date: Mon, 8 Mar 2021 10:57:11 +0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH] aarch64: Fix SVE ACLE builtins with LTO [PR99216] Message-ID: <20210308105710.5o5yl52ld6d2b7rq@arm.com> Content-Disposition: inline User-Agent: NeoMutt/20171215 X-Originating-IP: [217.140.106.50] X-ClientProxiedBy: LO2P123CA0085.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::18) To VI1PR08MB4029.eurprd08.prod.outlook.com (2603:10a6:803:ec::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.50) by LO2P123CA0085.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26 via Frontend Transport; Mon, 8 Mar 2021 10:57:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6613cfe5-555a-488d-f393-08d8e220fa01 X-MS-TrafficTypeDiagnostic: VE1PR08MB5024:|PA4PR08MB6144: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: NTNkEWo8I9TqTZPAIwKkiqYwyaSXDLvDG7YwkGYTE11xiBob9fbOxBcSfU2I3dLxcTcntGs9fJalxu5kRJj/3BUgjv/uVabmg77eWVqYC14In/ESx7SDiR/3boKq/39ZqFAqWwL08DelVpTSJm11mcmP7FUrWyIiprD9Bsw5qrOF2Xlu2/KlJa+++dQHqDQOOg6F8Y5xnblM9cyDn4Xh7foWNrj42lnXWnqLHtHGCtvh4KYIAd3CGW08Eu5XTivdN8pxASKajk4AlYBiycois9hRIB/V21D/X9Nxghn5cCEm5ksh2Q7/I5xF7xCIvkGZBmCvOITadDdonFTaT1X77M7VLZmQCd7xPdox+GzYcY6r+pqWXlR71rjkPGRbL2VmoMO8Zi/li9KCk9GHXqviXg9ILkoAgmKpWAEXksqsepLnKCgPXFNjfHxeOCvFuHPBdhFPWcrXrAZgrUuJjAIzoHiXwx3gQHT62gfOfHI9If8Srem4knnE1hIhxbwO+ckXGIAjYkK0chcfvKueXiTp2tkOTIxQvtIulmrfoSg8rl+qg3ICkHmrPlGqMcsqhE2pIjCObbRevU6vjIBNW/FAKQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB4029.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(136003)(39850400004)(346002)(396003)(66946007)(66476007)(66556008)(54906003)(66616009)(8886007)(44144004)(36756003)(7696005)(33964004)(1076003)(21480400003)(316002)(52116002)(235185007)(5660300002)(26005)(44832011)(4326008)(6916009)(186003)(16526019)(55016002)(956004)(478600001)(8676002)(8936002)(2906002)(86362001)(2616005)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?fm9L2yGLaMiebo0ccplJ2MixZIrQwV?= =?utf-8?q?eR3yIhqn2AKSOdN6AJXSiuNz4ppGX6HudN11wbFCmlhiWJKr5VhlwMfwmDljZbERK?= =?utf-8?q?RcdDVO5XUQM0EDlRfMFTpiR1k7CpR5NltAvaR4SE6f5epOQhqhYZ738wzdt27fDqL?= =?utf-8?q?sBF9eRGo+ma+clUWzms4LG+O27+6LJK+QvkF9/Hklzj2XNj2r+rPt3LOQg7SxfX7k?= =?utf-8?q?zVmu7CzBUSjUqAiIf+esbO+l8zGvHDpxV+hFKNiAUAaPpgGKYTvSLJ2jVNAGDqtJ4?= =?utf-8?q?eAqEnnrQDUW+dhbiLGoPdCzeYGEl3jDvAJAMXcUDmbwiul2MR/LwtH/AEThPa1cAm?= =?utf-8?q?Ts2DagT9wxMPLEo6l0TnobKFGNM+9krqoqsjLHUwPvJEqnwuLkU6LriyfbRTd6occ?= =?utf-8?q?9eQX3AzXZqfNrgGU04xEzpjjSSX80it/k3fBdpfy7MNT6pAyoXc3tXdjqW9Jm7EzX?= =?utf-8?q?aTrMKFhdLj2Zjv2Suw/GwlKl/4tIq+RnwsWcjxgLqbQP/QGLM6lQIDCoLartgvEZt?= =?utf-8?q?/jxfpIPnLBeTOKeXtajSrCX53E2yUQTRck1t4yipEQCxIHPymAK5QSXuRdHTeDdNo?= =?utf-8?q?NMuruU2gR2imjmGHPKce8dleCJXzhjMARLnI/ZsqPdVMusr9oATO0v26U4ZOqoOTJ?= =?utf-8?q?4uu6MWoXHufYBVAhb7UWW4EVBys9yvzvtWeL9tu3QoKLS/PpEuJ/3guegRZOTdYsh?= =?utf-8?q?2EBt3N+G0yHsbpQ8R0zAZF00JX2ZFRY78T3Ad5kYCbME4Svw9WNpyIj/ZnZ1BXzYW?= =?utf-8?q?3YRvkAoRSnNlJ54jCsBBb99xOGwd8xhiXilAjr4KGOeY66fBZPKedxF4z2G0TfWXc?= =?utf-8?q?VaIZQX18+ScNVABS3KnmDx894u5PXBpObGOujNQ3RSe46GZBc83i2JefuTTruUzjr?= =?utf-8?q?dfEdl0/FUzF8CnwoihP05xdMTcG2EsAbDa0JjtjG3JOmfyZmV7W4YV1lQ5W5DaUii?= =?utf-8?q?ama4evsz7BM8joumMyTQiiXyo+z1xoegwHVBnQNYFmTlv0aakjom3X35lY9AL7256?= =?utf-8?q?RrQC974uKZIH3InHlHSOnHIHoWr/w/08ACTHCJ9KN3UZ1vOUOlMYWpOSaz+rTsrhB?= =?utf-8?q?8M3fr09xiB3HzJuxBtJkHS7asCyWe8Gg0NwjdRN33hGpt8HDHL5M0tOUM3xvuhoHb?= =?utf-8?q?ZYD/aZoA9wpm2GmonMr1lSe8HLnyRpBZ9mY0OSJJQmmekxCQlWPou/9O3UuGmcIdh?= =?utf-8?q?rIo4fVSYeS59FG/d1ybu0nab31qmfq/wZG7je1UlVTVRqrUmVeGXA2HAQlPXIWRfu?= =?utf-8?q?0A9x+7vDPcdy42?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5024 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 2e398cb0-799a-42f9-3987-08d8e220ee86 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GKNV2N6LwjqNLv2Mm0Fw0kfzC6/glCcQ3fz99MZg6DDZqqijs6kyRJGvmnYYxNQu5tmXpALLfq1Jqb2TfZC0gG6thn0NRgpaQIRUeSAN38yly/QVCs01Kp5tpV24FSrWL+iS8UcNp9yi7pJH7q9fo9G0KtDtn6ihnZXAIyK1lLMa9mxMLz1cUI8eeVvSVsWqdWUiS29dxVRJT/55jzcUgf2RwLgZpYiAWDLsM0/FkxDQwtDrPXh+iPudt1dZXx04/R7MSsxBghYc3zsyOSIZtaqOU395yoGPaM6CQPtldRkZJMgfGyAJJOjkdabpRjLdSJNrhp7PKNgO5BHlLAlZUyvQ4EdtNdxE4s1TnxMCCau82dpxF0aHYjPkBj/cA1ps6AmiQ/0Bx3ypPRYAqgnRC6Ma1lyrL/oZQ8MznslilZxRFEtKlsVeHscSMtZqGuofyXgPRFwdse4lGT+qgv4V1Na0Lc5V9SeRvzOgvuAacETkxZGBlfJHIMap4J9Vz47nSo9Oz9VsWchGkugRGCLEmnohcg3FjzTV7L5Pw2eTwCE/r7NBWdVrdK70eDZe0ueVNJ4aWPjQ6fLS88k1BTxkz2/dF4ct9ni5cJPj3EE2KGoHhVT7LWhBD+vF6KDEDKNO0CT7Rp7hyp6XtHZqwjgnY23nCpIaredLELzryKcB20DhXwih5csEFCseBtSzZaYl 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:(4636009)(136003)(39850400004)(346002)(376002)(396003)(46966006)(36840700001)(82740400003)(70586007)(186003)(16526019)(356005)(81166007)(66616009)(70206006)(1076003)(54906003)(55016002)(82310400003)(316002)(4326008)(336012)(26005)(235185007)(36756003)(8676002)(33964004)(6916009)(47076005)(44144004)(7696005)(8886007)(5660300002)(2906002)(86362001)(44832011)(956004)(21480400003)(2616005)(36860700001)(8936002)(478600001)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2021 10:57:33.4107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6613cfe5-555a-488d-f393-08d8e220fa01 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: DB5EUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6144 X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Alex Coplan via Gcc-patches From: Alex Coplan Reply-To: Alex Coplan Cc: Richard Earnshaw , Richard Sandiford Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi all, As discussed in the PR, we currently have two different numbering schemes for SVE builtins: one for C, and one for C++. This is problematic for LTO, where we end up getting confused about which intrinsic we're talking about. This patch inserts placeholders into the registered_functions vector to ensure that there is a consistent numbering scheme for both C and C++. Initially I tried using a null decl for these placeholders, but this trips up some validation when the builtin trees are streamed into lto1, so I ended up building dummy FUNCTION_DECLs as placeholders. To get better test coverage here, I'm wondering if we could make some of the existing ACLE tests also run with LTO? Perhaps as a follow-on patch? For now I've just added the specific testcase from the PR. Bootstrapped and regtested on aarch64-linux-gnu, OK for trunk? Thanks, Alex --- gcc/ChangeLog: PR target/99216 * config/aarch64/aarch64-sve-builtins.cc (function_builder::add_function): Add placeholder_p argument, build placeholder decls if this is set. (function_builder::add_unique_function): Instead of conditionally adding direct overloads, unconditionally add either a direct overload or a placeholder. (function_builder::add_overloaded_function): Set placeholder_p if we're using C++ overloads. (function_builder::add_overloaded_functions): Don't return early for m_direct_overloads: we need to add placeholders. * config/aarch64/aarch64-sve-builtins.h (function_builder::add_function): Add placeholder_p argument. gcc/testsuite/ChangeLog: PR target/99216 * g++.target/aarch64/sve/pr99216.C: New test. diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 25612d2ea52..c0ba352599c 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -999,12 +999,25 @@ registered_function & function_builder::add_function (const function_instance &instance, const char *name, tree fntype, tree attrs, uint64_t required_extensions, - bool overloaded_p) + bool overloaded_p, + bool placeholder_p) { unsigned int code = vec_safe_length (registered_functions); code = (code << AARCH64_BUILTIN_SHIFT) | AARCH64_BUILTIN_SVE; - tree decl = simulate_builtin_function_decl (input_location, name, fntype, - code, NULL, attrs); + + /* 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. + + The placeholder needs to be non-NULL and some node other than + error_mark_node to pass validation when the builtin is streamed in to lto1. + + It's also convenient if the placeholder can store the name, so build a + FUNCTION_DECL, but don't register it with the frontend. */ + tree decl = placeholder_p + ? build_decl (input_location, FUNCTION_DECL, get_identifier (name), fntype) + : simulate_builtin_function_decl (input_location, name, fntype, + code, NULL, attrs); registered_function &rfn = *ggc_alloc (); rfn.instance = instance; @@ -1036,7 +1049,7 @@ function_builder::add_unique_function (const function_instance &instance, argument_types.address ()); tree attrs = get_attributes (instance); registered_function &rfn = add_function (instance, name, fntype, attrs, - required_extensions, false); + required_extensions, false, false); /* Enter the function into the hash table. */ hashval_t hash = instance.hash (); @@ -1047,16 +1060,14 @@ function_builder::add_unique_function (const function_instance &instance, /* Also add the function under its overloaded alias, if we want a separate decl for each instance of an overloaded function. */ - if (m_direct_overloads || force_direct_overloads) + char *overload_name = get_name (instance, true); + if (strcmp (name, overload_name) != 0) { - char *overload_name = get_name (instance, true); - if (strcmp (name, overload_name) != 0) - { - /* Attribute lists shouldn't be shared. */ - tree attrs = get_attributes (instance); - add_function (instance, overload_name, fntype, attrs, - required_extensions, false); - } + /* Attribute lists shouldn't be shared. */ + tree attrs = get_attributes (instance); + bool placeholder_p = !(m_direct_overloads || force_direct_overloads); + add_function (instance, overload_name, fntype, attrs, + required_extensions, false, placeholder_p); } obstack_free (&m_string_obstack, name); @@ -1084,7 +1095,7 @@ function_builder::add_overloaded_function (const function_instance &instance, { registered_function &rfn = add_function (instance, name, m_overload_type, NULL_TREE, - required_extensions, true); + required_extensions, true, m_direct_overloads); const char *permanent_name = IDENTIFIER_POINTER (DECL_NAME (rfn.decl)); m_overload_names.put (permanent_name, &rfn); } @@ -1098,9 +1109,6 @@ void function_builder::add_overloaded_functions (const function_group_info &group, mode_suffix_index mode) { - if (m_direct_overloads) - return; - unsigned int explicit_type0 = (*group.shape)->explicit_type_suffix_p (0); unsigned int explicit_type1 = (*group.shape)->explicit_type_suffix_p (1); for (unsigned int pi = 0; group.preds[pi] != NUM_PREDS; ++pi) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h index 620e18841b2..b701f90ac1a 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.h +++ b/gcc/config/aarch64/aarch64-sve-builtins.h @@ -337,7 +337,8 @@ private: tree get_attributes (const function_instance &); registered_function &add_function (const function_instance &, - const char *, tree, tree, uint64_t, bool); + const char *, tree, tree, + uint64_t, bool, bool); /* The function type to use for functions that are resolved by function_resolver. */ diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr99216.C b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C new file mode 100644 index 00000000000..61a58a7fcf4 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr99216.C @@ -0,0 +1,5 @@ +/* { dg-do link { target aarch64_asm_sve_ok } } */ +/* { dg-additional-options "-flto" } */ +#include +bool a; +int main() { a = svaddv(svptrue_b8(), svdup_s8(0)); }