From patchwork Mon Nov 4 15:17:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alfie Richards X-Patchwork-Id: 2006282 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=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=GWccNibO; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=GWccNibO; 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 4Xhw8y6Xzmz1xxW for ; Tue, 5 Nov 2024 02:18:42 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F3D523857BA9 for ; Mon, 4 Nov 2024 15:18:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2060b.outbound.protection.outlook.com [IPv6:2a01:111:f403:260e::60b]) by sourceware.org (Postfix) with ESMTPS id 3EEF83858C5F for ; Mon, 4 Nov 2024 15:18:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3EEF83858C5F 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 3EEF83858C5F Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260e::60b ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1730733496; cv=pass; b=CYpeVd6RYc0jC8Ax3vUC9IbAwUT7Ktg4odtWqLz0ZICd7wVlUJG25gDpI6Umo0AeZLcQsRFz3D0Uko0d/97bg0xxblzq0jiTTqamL4qj5MeO0nmXP2voUgAjtLsmk4SPVwSHRjSpJ8LxonDEdbW/fmuhFzyOhDwVq+t+OML6iHI= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1730733496; c=relaxed/simple; bh=sjG0wHXZfed6hgtLPyRvmCMsX0EM2xaiZ+vSUmNuQes=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ULzTb8gXYvbv8UHwdTL97kro0DSKeI22OyRWA5d2XgOg2RysexzI1RX3YOFSUXME749oEIGYjzc5yu1S2I6lJX72tSBHZSOiXDpZowoXIuPcDS0lono5eO0ovtEho5w069EJYQexhTqDWnDh29YthjYkJiOe1Egcomk2euFV5B0= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=EOCAFC3YWK9gHGKYkR7Tri+VIs5zDdpWqtKqtYGdNAm3J/aM7zZEHXfYx+Kd8PSQR0ZprCkulfUGsy+L3ddDhPM6OrGdeEWAeOJRIpZrVbLpQ8CjNCpz+k+In/SRj5CeCE41zB4/BNkEqrm+KGdiYE1lmLafz2Jt4Q2/aQmTM6HwewUiXyXEONAJqoDtW8O11tWFDV42FK6Xq6q0JGRsrlYqHYsJbhvfeS4wfN+pH+SFZAJN6B1xmjTmdWDEcnhitc9xgzLV0javfRK6his0y+6kKmwHiLLQeqQ8FctubVpIkvISzdmvsoAnoIxnGngXmwPdZmmSVHbOMlsHRNLQ3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=TQPdLKvate/79WcQ3DUcqRvfI9XXMXYP2XvFYI1Kxmo=; b=JDdi80sql+jMUGMV9ozqzA0O8MI7aGXybZkCmmj5dzAQJy8cAggJcrG5bT/h5eYqJk0WP3bF9n2qmlYvSXTYIHXXVIVw/KGUV4aOQmrLDqJvXgqd+fBlEbpFQbnsVUSaUdny+D8N+lUQUKHaPGIdqpWHlosHbeoVly5mjQfkuUCGnQQ+gZm8+knrvHGOIcUBEPvTcJrlAKiFbeGQz8t6fCtIFEcn3dZZ6C7E82BkghhkpzGiXtDXGnNq8PgYxfXlMWbBpKmLL6dA6HFRZQVMbpvU3DPxBuv1Fwa7f3tqYBJiBj5m+Ldr6IumhhbK0qc+Kdh9Pi8dsLq0e755P19DIQ== 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=arm.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=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TQPdLKvate/79WcQ3DUcqRvfI9XXMXYP2XvFYI1Kxmo=; b=GWccNibOpmO7+syJ4DuI6Sqcn1+2iix3TfUgypV0IZu1ORwTpX+fX6bHPkfYjqaxg5YsFGuLXER/xGME90Xr6kX66zKJC2jFxkPuXlKrUwRnx9eOyUoph71q6Ivepkm44kgeQi1FDPtKHHdRajBcUJc9PVW0/k3283bVjY5VwjQ= Received: from AM0PR02CA0160.eurprd02.prod.outlook.com (2603:10a6:20b:28d::27) by AS8PR08MB6184.eurprd08.prod.outlook.com (2603:10a6:20b:29c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 15:18:06 +0000 Received: from AM3PEPF0000A795.eurprd04.prod.outlook.com (2603:10a6:20b:28d:cafe::fc) by AM0PR02CA0160.outlook.office365.com (2603:10a6:20b:28d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 15:18:06 +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=arm.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 AM3PEPF0000A795.mail.protection.outlook.com (10.167.16.100) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 15:18:05 +0000 Received: ("Tessian outbound 72f4d55e3d4f:v490"); Mon, 04 Nov 2024 15:18:05 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d8ffde259f7d0f15 X-TessianGatewayMetadata: ABnneWNtR7sTqukugassZgTgwON1MRqqKHywQFHcwodHBjYAtMh0d6QYau+J2LOwzYevcn5P/DMCt3GeQXA4CQrmBtcPHtUR9Ugy1kgwg6O1uc/9CIq0OjnRosDW0ZH+dwJOI4yU4DHYvit1AnW3vBjOKqcDYRP+gAgSBEB2+kw= X-CR-MTA-TID: 64aa7808 Received: from Ldc8bcff4a317.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E55DFC3C-FA69-45FA-8183-2645D3F933CD.1; Mon, 04 Nov 2024 15:17:54 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Ldc8bcff4a317.2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 04 Nov 2024 15:17:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BmprLr5vrb5zyS2Du/UQkeDP9W+SvStnDSc2TwYHnwuCBcVLaN4fo0t+6GcV2DENXsj+3gJTL9xej3I3lU0hgudz/3DZUO6qJpLUO6NrkYijegYcPbhwHEz9M8e5m8oalyInelfx8caYnyRRK6sUtQFAbpeNatVFKhuuxq7HQhCvvx7/+f053jtfH1J6DtvmZEkcE5VeIU/AAFamCUPMM6HpXwa58wySqlrQYKLmAwIP2KcmsGVeBFD7RKVCDGzDskS8uuRC4OZaXSn2t6ETI1cuY8iET8MlrTDX5T5F+dUKrVPhIv7MgjVouCFjRRDzJ7p/k/7A143xOCY48WFJTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=TQPdLKvate/79WcQ3DUcqRvfI9XXMXYP2XvFYI1Kxmo=; b=EjPl2hVBg0GBC8+SbFk/6uOn7uafm60J5mmyXcEIWSwT4z7XIVJ8ZApM/+GanTmcJApsngYvCg9lC5F9vRnc4pW+Ib5YkxhX7pSW478zLlFeTK1TuG5nD3vrsL/IFT6A8IR1gG/XLBqLvb1odBhCNAhGanpSlkQiiJJyG3UlVPgw+iKwE8BjJ0EYjq3gBzSOL5YGMfst7JNYclil9p2Jio8rlKSGsq9CQt3/Um8s54LI39sOl3HbC7tzvK9qgPO0OLEoXDLToKyIZH86krdPZvpAejVVcLivDJLdpH+BuAFSzT0jM+/zDmFbigfYTKfCj2Y72e9Z2PyBI2vcvllFFw== 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=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TQPdLKvate/79WcQ3DUcqRvfI9XXMXYP2XvFYI1Kxmo=; b=GWccNibOpmO7+syJ4DuI6Sqcn1+2iix3TfUgypV0IZu1ORwTpX+fX6bHPkfYjqaxg5YsFGuLXER/xGME90Xr6kX66zKJC2jFxkPuXlKrUwRnx9eOyUoph71q6Ivepkm44kgeQi1FDPtKHHdRajBcUJc9PVW0/k3283bVjY5VwjQ= Received: from DU2P250CA0015.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::20) by AS8PR08MB8158.eurprd08.prod.outlook.com (2603:10a6:20b:54f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 15:17:48 +0000 Received: from DU2PEPF0001E9C0.eurprd03.prod.outlook.com (2603:10a6:10:231:cafe::e3) by DU2P250CA0015.outlook.office365.com (2603:10a6:10:231::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Mon, 4 Nov 2024 15:17:48 +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 DU2PEPF0001E9C0.mail.protection.outlook.com (10.167.8.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Mon, 4 Nov 2024 15:17:48 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.39; Mon, 4 Nov 2024 15:17:48 +0000 Received: from ip-10-248-139-135.eu-west-1.compute.internal (10.252.0.220) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 4 Nov 2024 15:17:47 +0000 From: To: CC: , , Alfie Richards Subject: [PATCH v3] C: Support Function multiversionsing in the C front end Date: Mon, 4 Nov 2024 15:17:45 +0000 Message-ID: <20241104151745.550941-1-alfie.richards@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C0:EE_|AS8PR08MB8158:EE_|AM3PEPF0000A795:EE_|AS8PR08MB6184:EE_ X-MS-Office365-Filtering-Correlation-Id: f3309bee-4ed8-4f58-9a16-08dcfce3e20a x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info-Original: KkVDyarRMArYQKxe9djY57j0JShkmf4bDDw70cuQnhJMYD1ki9jQJgq0f1AeeEWTF/pkTTbBhDmu7jFJHL6F80lqR1u0n5Hcowy7yLt9IUjxoYHLS2Gp8RTkgH8bfFqJaTrl/Y/fuINuO1ACw/crGzYVR9+ej3wSWdysvDMbhU25ufcBvcV5hhT/sagYLZJa65FVuM6me6jRGZVgBxXW5xh4PGKyATU4SM/LPUjSbOHm4mbmQWKQ0P8+PAxdkDWVDbzlLf3n2/s8Es+nix8V8IdTkJ5+TMipkDX6pqBl8FfGxK3yh6laG0agLDKt/HMou/nm8e8y41PnwaQxH1eWMXuFWi8vudZ2U859hQHk7No4E4PjVUq+4riRT70DD4CQcArleKrHqtwAc8yX1lfidkXIs4I9ZdXRYXVA6HdJZjs5ZgN2UX+Ff0mYAMyFZBEsjIXMrm8qahjfZsxsv9ntWkPhU4NZGVhfSFxWAx6tYJExC66T7xmcSndOUrXFrYp4DKLdU4mzP+zZTt6NPLCn6wRPL+BdHDhJ30smX/RExrB4Ag8flddIHAJ7UDtd38D/WHdfA3unWpjxcz2JBroDxciOCsXUfFS/nhKeMT+Wg2/mhXTLUejAqnuZCJhfiDDJA6hSreeCzforJoj4M0AEIMbelIUjAiiXgE4o5o654s8pf4zxA3oDAUVaUVgSQ0wyqKMIK3kCFKPhmZj81NOOHf3p34aJyblKjDLeDsZpD4ucJ2hiHZXLFLsMBhYXVZQ0ZbRxK+h0ZT2M4tWv2j3kNfx9N/ATHHGE14KymrlR8TW0p0S31ucpd3H2tq1KSwGwpUhfCboQ1GBonyyeI80nwxUY5nc9fanzHW6MPBQwe318jZhJrc88q3X3iN0QdypvQKvHdu7He0zwaxpRlxnWfE9+nWkvpQBhU7YpEt0uKXmcz9N9X2pQj3AIE1KvcYppQkTX+uiGgfNkvaCn6t7/HOM4BFH1aayl+b1fJQWm1fRDtlpBpU9soxwR08EV3vEeT/PuILfvede8OhKrTAEv0n62QUMSNH0W2AZoChImuUVryHoQ794xjVpdVPJvppiBfEgJDYFwCYDovsdwx5o0m71SOCTFVXtNhk9kllk8WfWbsbBJorJiQJswpUfABjHw1BfCSC28GN63kJonMlCUaQ3/x+jJSGmOr+P6DWMN3RHsGtFLL7MZm7m45kP2d/3fAl2Txz0ls4yo9un0ZlUnbdmsNcBEf0Xd6pRPDV5lnphe3HjiOE1e4q3dh3KnskF89bRqXspMs85vtpN3+Tu/NOR4Pjqx/UcNw0yPN3WyK+rllTQbRh1BUIqby4hVCZ8qevoWjBIE6oS7BgehNKZaR8T7b1/WwsdmIJcKFz0OU6qZgHjDmunLONmBV4+RhAzA 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:(13230040)(36860700013)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8158 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:10:231::20]; domain=DU2P250CA0015.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM3PEPF0000A795.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bf32502c-2f03-4c72-6e55-08dcfce3d7c0 X-Microsoft-Antispam: BCL:0; ARA:13230040|14060799003|36860700013|82310400026|35042699022|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?1DqRpI3xTtGDQcbi1iS8Q+M+BFpi5Qq?= =?utf-8?q?GEaJnqCj0N9ERmgLnocZYeQ9B+jJxNGVwMUaHIBx/ZDRmy+/VU9Cepb7BXUFr5FJd?= =?utf-8?q?fBGWEADq8lItoNYcaniyHzhMhp96+shxwrhdLaIQqu1d2k5sidquQ8rY+KALjboAD?= =?utf-8?q?/EMrrow2g9zkqMgyaBLu5CrKvq6N9u1wOURuYdi9Qp/NjT8khMtOuvWowbME2ByYs?= =?utf-8?q?k1U4NVxWhtk4L8fbLLDun3HuAix7RHqlFpj77PaUieauhaLsHpCLMPS3hLFwgkhiv?= =?utf-8?q?H/rHcqwGF2DwW2az+9Vbw9H8fKFyXlqWdSygmFOqSVQmmi8xcKkbxTw0k/2zusceU?= =?utf-8?q?PXgWBA5jIsitlwIOKZ/O+pJSj6MiIj9w6ISnLXN/q3OEuRZAMiowIddBAuvdJJFOZ?= =?utf-8?q?ecJhuatSe37k9ZZ/omi6R6wzOn8CJAk+Y3eC8O70TVckSviJ7drhgYQDOkaVuqQ9/?= =?utf-8?q?t/2bBYgjBgrv8W0VOU5Obr0hjmjnoPPoAkWedtapPAOWGXlvNM/eIeXZ9qEphaCQu?= =?utf-8?q?I5Z/bErCJfEvg1cStAUx3D+8fcprLVO4wkCYTo0vXWXNLzSFe3660p7sFDVVybXSQ?= =?utf-8?q?yLOTYBI+r0ukZJsDWK3TYTYxUxMGgFjwcitW0u/dsvzUlc2fH5sX26+cKVpynOXPE?= =?utf-8?q?qfYtKTasTsZVL6+6SG5/k5epKiNyptvzm9FfFsK6NMFWhFclZuTJmc03ax0hzR2+S?= =?utf-8?q?8w67krBDZBCLr0TXbrpiRviKZlTUw1s+odfdsi4/Gnr3l07vrcxaSi43It3suFnz8?= =?utf-8?q?Yx0iJaDFysBRW8JuJVcr0JeCNsOLiJOs8yaIjVE9nhZqxt3oS2dY6x8byt+rkHeGK?= =?utf-8?q?+XLA4m2v15l2qGojj3xwKUmCcZZiaOzUifjV+icy5EJ1aHmMYjbvEidyHCQiznmeD?= =?utf-8?q?vhuMFOX3PCKcqZ8cqo4F77AOhhDaF6UDQFw8ALp8JsHWPtdWr8DOf+ocSWe49Tmmm?= =?utf-8?q?LpwMtOz21ea/BFK+aHrSKZBlNgygwYJH/lP241JOIwYQKZWLcUmRO2u617sL4HKcf?= =?utf-8?q?KVvPkOzdV0BSSdbm8SMMvniSqbHg5uw7YRl1jwuzS0eLrGW7MezcCa1qL9IMy9ksO?= =?utf-8?q?CZZdjrB2XVRPYjVrNgbC30y14iwxopFdFcW0CIA9fFBmqXfDxOHnQWTGhrYgICRia?= =?utf-8?q?mecVIUpy83kXVp4bd6vyxEmIIB6p7XZeAs/krOPOGX//atX9Y/V+uxRdjRw1WSr/b?= =?utf-8?q?foLJ80KzbYkrKCZKr/o3zy075nmOmq727jKmWlbRXmaxWh5BD/MyflpbqzPLQvyhy?= =?utf-8?q?13dYrUwGJLyZMHfx+31MNm65Z21nYaJrs6ssc/iudmvr2QdJNXvKHC4z5SGrJX/DX?= =?utf-8?q?ywrCKTxmfHrA?= 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:(13230040)(14060799003)(36860700013)(82310400026)(35042699022)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 15:18:05.9107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3309bee-4ed8-4f58-9a16-08dcfce3e20a 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: AM3PEPF0000A795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6184 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 Hi, Joseph pointed out a pretty major flaw that this previously did not merge fmv declarations and definitons or check properly for duplicate definitons. I rewrote the fmv logic and moved it to pushdecl resulting in a patch that I much prefer. The logic in pushdecl now detects the FMV case and attempts to change the binding to run duplicate_decls on versions with the same target, to be merged/diagnosed as duplicate, or runs duplicate decls on incompatible decls to output the diagnostics. I added some tests for these cases also. Reg tested on Aarch64 and X86 Bootstrapped on aarch64-none-linux-gnu and x86_64-unknown-linux-gnu. Alfie ===== This patch adds support for `target_version` function multiversioning to the C frontend, specifically intended for enabling this for Aarch64 targets. The functionality and behavior matches the CPP frontend. This is likely to need to be changed later down the line for Aarch64 targets to match the updated ACLE details but that is future work. Note, in particular this adds a call to process_same_body_aliases to the C frontend. this function is seems to be intended to be used in the CPP and D frontends. However, not calling this function was meaning cpp_implicit_aliases_done was false for the C cgraph nodes and then references to the dispatched symbol were not being resolved resulting in the nodes getting deleted and a segfault later. I experimented with this patch on X86 and found that the assembler produces a duplicate symbol error. I would like input from relevant teams if there is interest in supporting this for their backends. gcc/c-family/ChangeLog: * c-gimplify.cc (c_gimplify_expr): Process calls to FMV functions. gcc/c/ChangeLog: * c-decl.cc (maybe_mark_function_versioned): New function. (pushdecl): Add logic for handling target versions. (c_parse_final_cleanups): Add call to process_same_body_aliases. gcc/ChangeLog: * calls.cc (get_c_function_version_dispatcher): New function. * calls.h (get_c_function_version_dispatcher): New function. gcc/testsuite/ChangeLog: * g++.target/aarch64/mv-symbols6.C: New test. * gcc.target/aarch64/mv-1.c: New test. * gcc.target/aarch64/mv-symbols-error1.c: New test. * gcc.target/aarch64/mv-symbols-error2.c: New test. * gcc.target/aarch64/mv-symbols-error3.c: New test. * gcc.target/aarch64/mv-symbols-error4.c: New test. * gcc.target/aarch64/mv-symbols-error5.c: New test. * gcc.target/aarch64/mv-symbols1.c: New test. * gcc.target/aarch64/mv-symbols10.c: New test. * gcc.target/aarch64/mv-symbols2.c: New test. * gcc.target/aarch64/mv-symbols3.c: New test. * gcc.target/aarch64/mv-symbols4.c: New test. * gcc.target/aarch64/mv-symbols5.c: New test. * gcc.target/aarch64/mv-symbols6.c: New test. * gcc.target/aarch64/mv-symbols8.c: New test. * gcc.target/aarch64/mv-symbols9.c: New test. * gcc.target/aarch64/mvc-symbols1.c: New test. * gcc.target/aarch64/mvc-symbols2.c: New test. * gcc.target/aarch64/mvc-symbols3.c: New test. * gcc.target/aarch64/mvc-symbols4.c: New test. --- gcc/c-family/c-gimplify.cc | 11 ++++ gcc/c/c-decl.cc | 65 ++++++++++++++++++- gcc/calls.cc | 22 +++++++ gcc/calls.h | 2 + .../g++.target/aarch64/mv-symbols6.C | 16 +++++ gcc/testsuite/gcc.target/aarch64/mv-1.c | 40 ++++++++++++ .../gcc.target/aarch64/mv-symbols-error1.c | 11 ++++ .../gcc.target/aarch64/mv-symbols-error2.c | 8 +++ .../gcc.target/aarch64/mv-symbols-error3.c | 8 +++ .../gcc.target/aarch64/mv-symbols-error4.c | 8 +++ .../gcc.target/aarch64/mv-symbols-error5.c | 11 ++++ .../gcc.target/aarch64/mv-symbols1.c | 38 +++++++++++ .../gcc.target/aarch64/mv-symbols10.c | 42 ++++++++++++ .../gcc.target/aarch64/mv-symbols2.c | 28 ++++++++ .../gcc.target/aarch64/mv-symbols3.c | 27 ++++++++ .../gcc.target/aarch64/mv-symbols4.c | 31 +++++++++ .../gcc.target/aarch64/mv-symbols5.c | 36 ++++++++++ .../gcc.target/aarch64/mv-symbols6.c | 16 +++++ .../gcc.target/aarch64/mv-symbols8.c | 47 ++++++++++++++ .../gcc.target/aarch64/mv-symbols9.c | 44 +++++++++++++ .../gcc.target/aarch64/mvc-symbols1.c | 25 +++++++ .../gcc.target/aarch64/mvc-symbols2.c | 15 +++++ .../gcc.target/aarch64/mvc-symbols3.c | 19 ++++++ .../gcc.target/aarch64/mvc-symbols4.c | 12 ++++ 24 files changed, 581 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols6.C create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols10.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols9.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index 09ea1b79159..d288303d118 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "tree-pass.h" #include "internal-fn.h" +#include "calls.h" /* The gimplification pass converts the language-dependent trees (ld-trees) emitted by the parser into language-independent trees @@ -904,6 +905,16 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, case CALL_EXPR: { tree fndecl = get_callee_fndecl (*expr_p); + + /* Change any calls to a multiversioned function to instead + * be a call to the dispatched symbol. */ + if (fndecl && DECL_FUNCTION_VERSIONED (fndecl)) + if (tree dis = get_c_function_version_dispatcher (fndecl)) + { + dis = build_fold_addr_expr_loc (EXPR_LOCATION (dis), dis); + CALL_EXPR_FN (*expr_p) = dis; + } + if (fndecl && fndecl_built_in_p (fndecl, BUILT_IN_CLZG, BUILT_IN_CTZG) && call_expr_nargs (*expr_p) == 2 diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 1827bbf0646..da5c293601f 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "omp-general.h" #include "omp-offload.h" /* For offload_vars. */ #include "c-parser.h" +#include "tree.h" #include "tree-pretty-print.h" @@ -2098,6 +2099,22 @@ previous_tag (tree type) return NULL_TREE; } +/* Subroutine to mark functions as versioned when using the attribute + 'target_version'. */ + +static void +maybe_mark_function_versioned (tree decl) +{ + if (!DECL_FUNCTION_VERSIONED (decl)) + { + DECL_FUNCTION_VERSIONED (decl) = true; + + tree mangled_name + = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl)); + SET_DECL_ASSEMBLER_NAME (decl, mangled_name); + } +} + /* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL. Returns true if the caller should proceed to merge the two, false if OLDDECL should simply be discarded. As a side effect, issues @@ -3365,11 +3382,53 @@ pushdecl (tree x) b->inner_comp = false; b_use = b; b_ext = b; + + /* Check if the function is part of a group of multiversioned functions. + If so, we should check for conflicts or duplicates between any with + the same version. If there are no conflicts, should just add the new + binding. */ + if (b && TREE_CODE (x) == FUNCTION_DECL + && TREE_CODE (b->decl) == FUNCTION_DECL + && (DECL_FUNCTION_VERSIONED (b->decl) + || targetm.target_option.function_versions (x, b->decl))) + { + maybe_mark_function_versioned (x); + for (; b_use; b_use = b_use->shadowed) + { + if (!comptypes (type, TREE_TYPE (b_use->decl)) + || TREE_CODE (b_use->decl) != FUNCTION_DECL) + { + /* Found a conflicting declaration. + duplicate_decls will create teh diagnostics forthis. */ + b = b_use; + break; + } + maybe_mark_function_versioned (b_use->decl); + cgraph_node::record_function_versions (b_use->decl, x); + + if (!targetm.target_option.function_versions (x, b_use->decl)) + { + /* Found a duplicate binding for the same version. */ + b = b_use; + break; + } + } + /* If no conflicting decl is found, then skip duplicate declaration + logic and record the new binding. */ + if (!b_use) + { + b_use = b; + goto skip_external_and_shadow_checks; + } + b_use = b; + b_ext = b; + } + /* If this is an external linkage declaration, we should check for compatibility with the type in the external scope before setting the type at this scope based on the visible information only. */ - if (TREE_PUBLIC (x) && TREE_PUBLIC (visdecl)) + else if (TREE_PUBLIC (x) && TREE_PUBLIC (visdecl)) { while (b_ext && !B_IN_EXTERNAL_SCOPE (b_ext)) b_ext = b_ext->shadowed; @@ -13686,6 +13745,10 @@ c_parse_final_cleanups (void) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); + /* Call this to set cpp_implicit_aliases_done on all nodes. This is + important for function multiversioning aliases to get resolved. */ + symtab->process_same_body_aliases (); + if (!in_lto_p) free_attr_access_data (); diff --git a/gcc/calls.cc b/gcc/calls.cc index c5c26f65280..bb8aaa8bb9a 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -5386,3 +5386,25 @@ cxx17_empty_base_field_p (const_tree field) && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)) && !lookup_attribute ("no_unique_address", DECL_ATTRIBUTES (field))); } + +/* Returns the decl of the dispatcher function if FN is a function version. */ + +tree +get_c_function_version_dispatcher (tree fn) +{ + tree dispatcher_decl = NULL; + + gcc_assert (TREE_CODE (fn) == FUNCTION_DECL && DECL_FUNCTION_VERSIONED (fn)); + + gcc_assert (targetm.get_function_versions_dispatcher); + dispatcher_decl = targetm.get_function_versions_dispatcher (fn); + + if (dispatcher_decl == NULL) + { + error_at (input_location, "use of multiversioned function " + "without a default"); + return NULL; + } + + return dispatcher_decl; +} diff --git a/gcc/calls.h b/gcc/calls.h index 464a4e34e33..6d076f0f810 100644 --- a/gcc/calls.h +++ b/gcc/calls.h @@ -134,5 +134,7 @@ extern void maybe_complain_about_tail_call (tree, const char *); extern rtx rtx_for_static_chain (const_tree, bool); extern bool cxx17_empty_base_field_p (const_tree); +extern tree +get_c_function_version_dispatcher (tree fn); #endif // GCC_CALLS_H diff --git a/gcc/testsuite/g++.target/aarch64/mv-symbols6.C b/gcc/testsuite/g++.target/aarch64/mv-symbols6.C new file mode 100644 index 00000000000..a0a612e7770 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/mv-symbols6.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +/* It is not overly clear what the correct behaviour is in this case. + This test serves more as a test of consistency for this case rather + than a test of correctness. */ + +/* { dg-final { scan-assembler-times "\n_Z3foov:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-1.c b/gcc/testsuite/gcc.target/aarch64/mv-1.c new file mode 100644 index 00000000000..eb43f33ffc9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-1.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("rng"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("flagm"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("rng+flagm"))) int +foo () +{ + return 1; +} + +int +bar () +{ + return foo (); +} + +/* Check usage of the first two FMV features, in case of off-by-one errors. */ +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mrng:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MrngMflagm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mflagm:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols-error1.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error1.c new file mode 100644 index 00000000000..2501cd0060b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("default"))) int +foo () { return 1; } /* { dg-message "note: previous definition of 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-error "conflicting types for 'foo'" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols-error2.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error2.c new file mode 100644 index 00000000000..537f9a682c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-message "note: previous definition of 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-error "redefinition of 'foo'" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols-error3.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error3.c new file mode 100644 index 00000000000..733c965d9a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo (int a, int b) { return 1; } /* { dg-message "note: previous definition of 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (int a, float c) { return 3; } /* { dg-error "conflicting types for 'foo'" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols-error4.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error4.c new file mode 100644 index 00000000000..9b1b7cf2be1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error4.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (int a, int b); /* { dg-message "note: previous declaration of 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (int a, float c) { return 3; } /* { dg-error "conflicting types for 'foo'" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols-error5.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error5.c new file mode 100644 index 00000000000..74d9ebada82 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols-error5.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () { return 1; } /* { dg-message "note: previous definition of 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo (); /* { dg-error "conflicting types for 'foo'" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3.0; } diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c new file mode 100644 index 00000000000..798227826e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// Basic case of fmv correctness with all functions and use in one TU. + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mv-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c new file mode 100644 index 00000000000..d5256389d7b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int +foo (); + +int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c new file mode 100644 index 00000000000..2e59ea9fb86 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with definitions but no call + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c new file mode 100644 index 00000000000..29bf17cac95 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with declarations but no implementation + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c new file mode 100644 index 00000000000..a476800b2c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with a default implementation and declarations of other +// versions + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c new file mode 100644 index 00000000000..344d1e6fe34 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with default declaration, and implementations of other +// versions. + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c new file mode 100644 index 00000000000..97e552689fc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +/* It is not overly clear what the correct behaviour is in this case. + This test serves more as a test of consistency for this case rather + than a test of correctness. */ + +/* { dg-final { scan-assembler-times "\nfoo:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c new file mode 100644 index 00000000000..3e3eaf21aa9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c new file mode 100644 index 00000000000..8e0864f1663 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c new file mode 100644 index 00000000000..3ad15e5bb73 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo () +{ + return 1; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c new file mode 100644 index 00000000000..78385ed904b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo () +{ + return 1; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c new file mode 100644 index 00000000000..d24293e8660 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c new file mode 100644 index 00000000000..abaf60f91c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */