From patchwork Fri Jul 31 15:01:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 140347 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3EF504B19712 for ; Fri, 31 Jul 2026 15:03:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EF504B19712 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=C27Sim/g; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=C27Sim/g X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11013033.outbound.protection.outlook.com [52.101.83.33]) by sourceware.org (Postfix) with ESMTPS id A120B4B35884 for ; Fri, 31 Jul 2026 15:03:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A120B4B35884 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 A120B4B35884 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=52.101.83.33 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1785510184; cv=pass; b=PhatVbqUEVZwKzzcPQh2ZyQIXcgO1/j0bWloqa5Sm5MjWGMTRwC64Iv8LZfIikum8yA2WGMShUK68k3KgDRl9aWF4m+XEau2elmtx2gfFoUrQszYpyCpy2esuUyEdQ0j565EodVy030t0WFNPCfZvOCdMBRm8R2/LTCAI/syCzc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1785510184; c=relaxed/simple; bh=kqxw2YXU3J49f0GlXHDBvd1gaTW9N6bkAj+AtFO+HaI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=uR+RtSZirPsixirBGtjo534aLkQU9Ws3PbI+j/ey/WPHptKz8sfuY2+SeyOJcF3U9OWUwWSMOu1MH7n8HT/4zOhqBYIDzZT+4xDAtU43SfA6xSj2NUpllOPQFH95JOCzQGl3iL40qN3OIbNmAxiOP4Y8gUplHlLeeKJGumH1djc= ARC-Authentication-Results: i=3; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=C27Sim/g; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=C27Sim/g DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A120B4B35884 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=knPfSB9kzUCgmwx2NVkTXRMQmcOXP8UXtEpEydC/UUKDE2JyjfpHf5sexUrariL2gEz8FHkAx5AwL+i8M7CWZmlbkchNFzmExRRq1jS73dERoE9Didj3kO+Rqb7a8CCtStHTeqFdx2TXFvbnuU0cCfz8PveHYkAVZBVqCWy5IDGDhQAxIPlGrL6FeQOSw/NQE66UV/EFfyRZi9uhup/rSpW6KqoZrNMVlj/0kZ25Jc5STkC54/C9CV5pYDxshOMyekY1pOIH9Z/s9XQgE4ZJsgIsKlxX68HGCBNsufRXfWrMi+zz98VsqHEwObnW4VGCd+FqWW8byeWrJSkV4VvlcQ== 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=cRaxKuOBXqiGtWNuiGEg5jMM66hjX1EoJ7hkTdCgrMQ=; b=dOZUepAfLboQuplEHde6Dzi5L9pwMNIxWEieFtIEgv2FNQqDfm7rdFwS0gKDdu+zqNzJsh5mDtFXb+989HQq/6zX5g1U6C1QvDS+UV+C2eNyVt1oxjcNJrBtJ+HVFnI+zWH7nHEbw3/TtXZJQkcsOMxXERLAm63GUy9WQ7zApKbwAUqMfbHbI4Brud/Zaa+AH+6UjdSbZ4zleZJJFzaNv7vTDxrcNFK+IFdawJn8BgLa0KJdhenf7wcHOOCvMwLLNFUas0Sqd2y/Y551qO2xx3PNq7d7dUUXvoJ5WLxkPIviPgqoVeqMCKErrjs8/Uh2rmvFdPWE7OJdjgakoCHRBA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.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] 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=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cRaxKuOBXqiGtWNuiGEg5jMM66hjX1EoJ7hkTdCgrMQ=; b=C27Sim/gaJRpgRqaTPWXr2BE4rlJcWS30iAWGYswhTBnY76CyS8unULPie2yurgYt0ZjD4oo4RZ7LInuIzlvrxKOqOJ9mhAizrxJBQ1I4Ay0X524Zb84AziolxOh+qVyAya27peGNePsOL2TLVZr63qn8ynRzrbSYmzHnSn5+Hc= Received: from DU2PR04CA0254.eurprd04.prod.outlook.com (2603:10a6:10:28e::19) by AS2PR08MB10054.eurprd08.prod.outlook.com (2603:10a6:20b:649::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.15; Fri, 31 Jul 2026 15:02:49 +0000 Received: from DU2PEPF0001E9BF.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::1f) by DU2PR04CA0254.outlook.office365.com (2603:10a6:10:28e::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.15 via Frontend Transport; Fri, 31 Jul 2026 15:02:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) 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 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DU2PEPF0001E9BF.mail.protection.outlook.com (10.167.8.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.292.8 via Frontend Transport; Fri, 31 Jul 2026 15:02:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EeBmGAmf5Ib83fO7QKjJaJJm8+Gaz2Sbcc5UPzuE/+8YTOZAxyI/mwyh+2pF+QtHYtd3TohSbuMDLboI9nSBL+b2VbR9YIUE2dgIMAGzvWAxgAzvXLIVjkiNQfcm/1S3OLhe69l7/PPSeUSdie+be/v8BkxIhODxM97cUGH+oWHQ1xFqFZl4tdvFNF0AcgrPI8r0lj9PnvfAQlnvvyJXCxCL3Gr9E1qpkU87sdALSBjeNnFCLo1RPyWBVWdPjoPM6SojK5fpBY0weeOf4x9MVJV75//XLI4c8lA4dGwZjUBgYlV/6uYNO/0Wm913QAEhnUOZdlsNlq5Ciz5lC0VRyQ== 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=cRaxKuOBXqiGtWNuiGEg5jMM66hjX1EoJ7hkTdCgrMQ=; b=wT0P12f9zPbwtMCBYSNOCz2qBoN3ug+7w8v/92sJvnCQBdySQT4MGAzd2BFOvRkA/BpBWMmF3oURXBs8PhM6JWOTraQhLd7lfabIaFYsy+zIbW9bJAwG4mMaOVGzNYZOT2s1f9SPdwSWDJWKKusyqExvFHIUJBtMSzvfYVRu39l16zEjf8P1FezQvuiAoHOqTVxks/KLTrfEzmY0JKEkHoeL18ab9lbYClNTYjyPWQz0jqd78uwlnT+YktFNR/MC4cMwWRse8kMlK0p8J9zwYQhmL4Q0uXWzwY1mcHn4LsYHGGZbVKmoAt37X0D/qPbuXiDPRaUpca/lD9GBtvlNWQ== 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=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cRaxKuOBXqiGtWNuiGEg5jMM66hjX1EoJ7hkTdCgrMQ=; b=C27Sim/gaJRpgRqaTPWXr2BE4rlJcWS30iAWGYswhTBnY76CyS8unULPie2yurgYt0ZjD4oo4RZ7LInuIzlvrxKOqOJ9mhAizrxJBQ1I4Ay0X524Zb84AziolxOh+qVyAya27peGNePsOL2TLVZr63qn8ynRzrbSYmzHnSn5+Hc= Received: from PAWPR08MB8982.eurprd08.prod.outlook.com (2603:10a6:102:33f::20) by PAVPR08MB8798.eurprd08.prod.outlook.com (2603:10a6:102:32c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.15; Fri, 31 Jul 2026 15:01:44 +0000 Received: from PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::5821:707a:c30b:dd9a]) by PAWPR08MB8982.eurprd08.prod.outlook.com ([fe80::5821:707a:c30b:dd9a%5]) with mapi id 15.21.0270.012; Fri, 31 Jul 2026 15:01:43 +0000 From: Wilco Dijkstra To: GNU C Library Subject: [PATCH] AArch64: Add SVE2 strchrnul Thread-Topic: [PATCH] AArch64: Add SVE2 strchrnul Thread-Index: AQHdIP06oYKOJx9oLkGReSbrwUM4rQ== Date: Fri, 31 Jul 2026 15:01:43 +0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: PAWPR08MB8982:EE_|PAVPR08MB8798:EE_|DU2PEPF0001E9BF:EE_|AS2PR08MB10054:EE_ X-MS-Office365-Filtering-Correlation-Id: 24dcd446-56cc-431a-1d3a-08deef14c949 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|366016|23010399003|1800799024|376014|11063799006|5023799004|56012099006|18002099003|10067099003|13003099007|38070700021; X-Microsoft-Antispam-Message-Info-Original: DRqbRTTes4C4FRCSj+VBbpHmLbjyuVFrAVVowdlXYcCD0KUn+FFMgX+RG2qUsWLZuqkUq+Dpy2d7hzP5VM6fPnq3GMZHMp0EECGtGKcdFORAifQ9I2CaLIG+7LdvhkwatumVqmMR+phP/dQc//vTGah1iUwlNT7keGXSoiv+6DLHMVOSWsGmfcO/tUbYdknPkSp0uBf4XFj4Ye1rt6NzD/gyje0r+gdzGr0OibOJOnqqOW3Kf+qew84T2+nq+ZaRL73UZwvzZ/j7swphRkr4U6Qr3bfpq0VlEzSDhndax4F2kvtJzm/+Iq/gffgq/UByVIwZ/M6igRfrHcy6gmZ/XsaeWxlp1bp7H1dK5Nrwhe5sqBblIaLbMVAOAbzcwN2Qik+czYTsL4AqrBY25tdcdlKpw3WYgB2mAb0HtYB2UnuqoPOgKukUhvmeWPiEm/G8gPkffkvM5i0T7b3M6XzRiYiRhg/4LRL9MWYuGNkORP4OeCi/HCEjyWLku1XS/gomCesJEaw32JgFRkO6s6N6TLpJHkBBnUQC3XQ0vlD7RxjF5p0afV+P/Vd/BC3IA/JogFiaVyT5gcZjZm+s9GJ8RkBEC3WNi2jRD77ZC09Dj0e7XATiL3keAfIh9/pKnXfQbGbFDH5zm/BXEZtFhih+7Ti0pbq1Zk35jRosLVPC3hkwEmB5FPmrtev1dXFiowFK19oJU960COs8X+mEe171ytDICKxd64SHpymsjyMUlf0= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8982.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(23010399003)(1800799024)(376014)(11063799006)(5023799004)(56012099006)(18002099003)(10067099003)(13003099007)(38070700021); DIR:OUT; SFP:1101; MIME-Version: 1.0 X-Exchange-RoutingPolicyChecked: Z2HYtMah4lVh/7JnJIVJe847JV/gCMgjP0WANAGreKLm7juD57SCtArFnACRkvdsRX9yZEnhXGCXpLgb1mfraiRlEkB8SnUWRW/eHhp8+4gFD0OEkXVfaz3kqSLOa1nYMVzrM0iK4HrXZMmuMwpUHfS9NmCiWnHbDSzYK+WKbSNqbbW8yOsMJPW/746mbYhTo3HF6nNs7nPP/dixLey8J4TJOcBBBzX3UXWobSZk0Rd5767IOQFPTd5xxYE3VQXlbvAQPi8yX93S9FbEAHywIwMsqL/E41M6cqWkwu6s8CANPULWd8uU+Yvab3tb+oNFgPKuJz4AZopYo8SbqQVnNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB8798 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF0001E9BF.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8402f1ea-b57e-4d48-ceed-08deef14a294 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|82310400026|376014|23010399003|1800799024|35042699022|14060799003|10067099003|5023799004|11063799006|56012099006|13003099007|18002099003; X-Microsoft-Antispam-Message-Info: 27795ggKefioPY+DpfjdrCJ5gbK+Iy2BqRVrmOSzTENeJsgUTq2GRsnugmGq8atkkOF24NnxfPlp3qwQ6DRQ/qoWr4W4jrdaF8ISTcxDIrWreXyQ7zTDdvMf9Gtr6eQ+b9BBq+yOJlp6FfZwcGxr0bFLFJgGpTBI3OFVHXghvbDAz4MAZ0jw5RTTYN8wqVLo4ImDVN8WmFHxFIJe0/pyYQY1qTihd/1tvah49UyXajEjjwgxGDwixHvGdbCFyTJ8gGRLOEuSN7HuMm067djxWB5gPawJEcjSanR+3AtgPYLmTSZREdNHFIozED+H205fLfVL44sfXwogPRZNL9pstPDZMUvpmk818gMfiYBtrQ4kkKVseH98OGSBfgBfI297vf8ofwQrLoFP/wFwySBueaKlO2hK/V+6Ev43jQoMq+xT5cX9cMnv4AsIViXE1hP0f1MAqPx7kFwPfE+xPlUnOk+TCQGsH/8WJgTufQ31/Pf3imauJiqYU+mrm4z460toF8K8M7g+KYyPM/WR9whMXDZG1kQHv0t5yWOa8qZTUGRZ5CLQHHT9Rri5iRHUnnYPq4nO6dW2/1ewmor+YhCSsA1m1sxa58dT+ZGhErl0/Kg8gTw4T8apJzXjfPGw+j8YpRtrf2oNsJYSBC48o4Y0Dg5f5+FxnTUFEioqlUcE9Tv/wJKEdTALkPes+15yjUVBBR6gjMwB1xsOSM4T8uZpLQ== X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(82310400026)(376014)(23010399003)(1800799024)(35042699022)(14060799003)(10067099003)(5023799004)(11063799006)(56012099006)(13003099007)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vuOQCM/ZkAMIQc6Jo0qqBf1hAmb1+usGSADBnQpxjHS03H8shumNlJ1beDD54anH2iv7ep4dT+qEPSJZPNuydHkEEJhrO4rXLhQDxqPLPF/6mHHtvFgSOb2iB552i0ggrDrLGU8/X1biEkoOO8Tt2Ur+/EBIhE9sHeF9bdO8o3ztP2w18UyOxjfka+wkyX1rhHdHhdWTbI7OxWZkyaHXLqzbbJqfBe0ZSWW4GG5+pRTpA68+j6SWo0sPYyRza1DBDPCiwUKL+hH4RN/4xy4npNOFaLC1am3XCse/geebnkMdWSBTgkHgKnt5KPdFhDOq20gotjKw/FUGtolm84Dj9G4kK0XiHRInuwWZXf1zUZgrdoHrUri3Qjfwht1LDwfd63hBWQv49TBM6pFFeFj6G4JDUais9fJMKxbg06aaH9tg6eMP+17L1S50RzE/z0Gi X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2026 15:02:48.8116 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24dcd446-56cc-431a-1d3a-08deef14c949 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF0001E9BF.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB10054 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Add an SVE2 strchrnul implementation and ifunc support based on strchr-sve.S. Use MATCH to check for both the input char and NUL. Performance of bench-strchrnul improves ~34% on Neoverse V2. There is an odd issue with HIDDEN_JUMPTARGET when building rtld - I've solved it by switching back to plain JUMPTARGET if not in libc. Passes check and buildmanyglibc. Note this depends on https://sourceware.org/pipermail/libc-alpha/2026-July/179267.html. diff --git a/sysdeps/aarch64/multiarch/Makefile b/sysdeps/aarch64/multiarch/Makefile index 9f202512f1e32ddc0177d030bf295d3b7e202c1c..b85be3062eed1b6c4df109a72975ade1d37a5b73 100644 --- a/sysdeps/aarch64/multiarch/Makefile +++ b/sysdeps/aarch64/multiarch/Makefile @@ -18,6 +18,8 @@ sysdep_routines += \ memset_zva64 \ strchr_generic \ strchr_sve2 \ + strchrnul_generic \ + strchrnul_sve2 \ strlen_asimd \ strlen_generic \ # sysdep_routines diff --git a/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h index 50b2581455c94dc2bd38f8e5ba9a357d1b79e89f..74fdca91baa562316f8f0a4d2450e9dd81aabb9c 100644 --- a/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h +++ b/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h @@ -23,6 +23,8 @@ asm ("memset = __memset_generic"); asm ("strlen = __strlen_generic"); #ifndef SHARED asm ("strchr = __strchr_generic"); +asm ("strchrnul = __strchrnul_generic"); +asm ("__strchrnul = __strchrnul_generic"); asm ("memcpy = __memcpy_generic"); asm ("memmove = __memmove_generic"); asm ("memcmp = __memcmp_generic"); diff --git a/sysdeps/aarch64/multiarch/ifunc-impl-list.c b/sysdeps/aarch64/multiarch/ifunc-impl-list.c index a0c93147c532d935d562a66ac67ebaa5326dd3bd..5f5350850dd5d8270c2675fdbdc3be0f110f7116 100644 --- a/sysdeps/aarch64/multiarch/ifunc-impl-list.c +++ b/sysdeps/aarch64/multiarch/ifunc-impl-list.c @@ -63,5 +63,8 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, IFUNC_IMPL (i, name, strchr, IFUNC_IMPL_ADD (array, i, strchr, sve2 && !mte, __strchr_sve2) IFUNC_IMPL_ADD (array, i, strchr, 1, __strchr_generic)) + IFUNC_IMPL (i, name, strchrnul, + IFUNC_IMPL_ADD (array, i, strchrnul, sve2 && !mte, __strchrnul_sve2) + IFUNC_IMPL_ADD (array, i, strchrnul, 1, __strchrnul_generic)) return 0; } diff --git a/sysdeps/aarch64/multiarch/strchrnul.c b/sysdeps/aarch64/multiarch/strchrnul.c new file mode 100644 index 0000000000000000000000000000000000000000..d09508880655bada4ca9185a5cedf28714d10a31 --- /dev/null +++ b/sysdeps/aarch64/multiarch/strchrnul.c @@ -0,0 +1,41 @@ +/* Multiple versions of strchrnul. AArch64 version. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Define multiple versions only for the definition in libc. */ + +#if IS_IN (libc) +/* Redefine strchrnul so that the compiler won't complain about the type + mismatch with the IFUNC selector in weak_alias, below. */ +# undef strchrnul +# undef __strchrnul +# define strchrnul __redirect_strchrnul +# define __strchrnul __redirect___strchrnul +# include +# include +# undef strchrnul +# undef __strchrnul + +extern __typeof (__redirect_strchrnul) __strchrnul attribute_hidden; + +extern __typeof (__redirect_strchrnul) __strchrnul_generic attribute_hidden; +extern __typeof (__redirect_strchrnul) __strchrnul_sve2 attribute_hidden; + +libc_ifunc (__strchrnul, (sve2 && !mte ? __strchrnul_sve2 : __strchrnul_generic)); + +weak_alias (__strchrnul, strchrnul); +#endif diff --git a/sysdeps/aarch64/multiarch/strchrnul_generic.S b/sysdeps/aarch64/multiarch/strchrnul_generic.S new file mode 100644 index 0000000000000000000000000000000000000000..ef11f563c318967e7ff0255a590d20d2042b6728 --- /dev/null +++ b/sysdeps/aarch64/multiarch/strchrnul_generic.S @@ -0,0 +1,38 @@ +/* A Generic Optimized strchrnul implementation for AArch64. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#if IS_IN (libc) + +# define STRCHRNUL __strchrnul_generic + +/* Do not hide the generic version of strchr, we use it internally. */ +# undef libc_hidden_def +# define libc_hidden_def(name) + +# undef weak_alias +# define weak_alias(a, b) + +# ifdef SHARED +/* It doesn't make sense to send libc-internal strchr calls through a PLT. */ + .globl __GI___strchrnul; __GI___strchrnul = __strchrnul_generic +# endif +#endif + +#include "../strchrnul.S" diff --git a/sysdeps/aarch64/multiarch/strchrnul_sve2.S b/sysdeps/aarch64/multiarch/strchrnul_sve2.S new file mode 100644 index 0000000000000000000000000000000000000000..3a037446d851e060790369e7ea78be8573fed56b --- /dev/null +++ b/sysdeps/aarch64/multiarch/strchrnul_sve2.S @@ -0,0 +1,22 @@ +/* Optimized strchrnul for SVE2. + Copyright (C) 2026 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#define BUILD_STRCHRNUL + +#include "strchr_sve2.S" diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S index c80807ea73d85493982e60d023c4c137b6c9b311..6498e7cb69298bf271176dffaf50699bd43e9b5f 100644 --- a/sysdeps/aarch64/strchrnul.S +++ b/sysdeps/aarch64/strchrnul.S @@ -26,6 +26,10 @@ * MTE compatible. */ +#ifndef STRCHRNUL +# define STRCHRNUL __strchrnul +#endif + #define srcin x0 #define chrin w1 #define result x0 @@ -50,7 +54,7 @@ which things occur in the original string, counting leading zeros identifies exactly which byte matched. */ -ENTRY (__strchrnul) +ENTRY (STRCHRNUL) bic src, srcin, 15 dup vrepchr.16b, chrin ld1 {vdata.16b}, [src] @@ -93,6 +97,6 @@ L(end): add result, src, tmp1, lsr 2 ret -END(__strchrnul) -libc_hidden_def (__strchrnul) -weak_alias (__strchrnul, strchrnul) +END(STRCHRNUL) +libc_hidden_def (STRCHRNUL) +weak_alias (STRCHRNUL, strchrnul) diff --git a/sysdeps/aarch64/strspn.S b/sysdeps/aarch64/strspn.S index 42f3b82a944503aa726bc8bdb61105721d0b959a..4683dfd90b3756d99c771f4da8b944d9a23274bc 100644 --- a/sysdeps/aarch64/strspn.S +++ b/sysdeps/aarch64/strspn.S @@ -128,7 +128,11 @@ L(early): mov w1, w2 mov fp, sp mov x19, x0 - bl __strchrnul +#if IS_IN(libc) + bl HIDDEN_JUMPTARGET (__strchrnul) +#else + bl JUMPTARGET (__strchrnul) +#endif sub x0, x0, x19 ldr x19, [sp, 16] ldp fp, lr, [sp], 32