From patchwork Wed Nov 26 13:54:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jovan Dmitrovic X-Patchwork-Id: 125344 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED1EC3858D3C for ; Wed, 26 Nov 2025 13:59:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED1EC3858D3C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=htecgroup.com header.i=@htecgroup.com header.a=rsa-sha256 header.s=selector1 header.b=istKTXxf X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11020116.outbound.protection.outlook.com [52.101.84.116]) by sourceware.org (Postfix) with ESMTPS id 8BDA13858D3C for ; Wed, 26 Nov 2025 13:54:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BDA13858D3C Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=htecgroup.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=htecgroup.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8BDA13858D3C Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=52.101.84.116 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1764165282; cv=pass; b=fokva2ICwt/qW36rDzCXJ/ymT0DpF1yhOdjmChDoIt6KTZkS2nS8eku6wSJMm64awfz1lXmLJCyXLP1HH3p2gNlEbTAziEGhv6y7cI3gOMQpOPOqfXNK/LEVNtpyUmC2SPKd/G8z3RN/NDuVb+nO6/WXYnzOPgQ3rteAYDy4I9U= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1764165282; c=relaxed/simple; bh=seIyYS1QnGXwnuie8PM/m0hjezUExF4Yi+dZCPL0XvQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PKwiRWW3SZ4A8Hp7N+YiFywZU0SZvd9/1+gqXl9VWW+bnDCyXSEmSp8IK717W7+0gC5lAryRPYWI/Vq8/p+OJ+BS7tCLd0ikAmfUUHFNbYbqji/aApAVyC4cpubgrbwbCLgFkCOKnf3kCYjjgqZb8f2Jnl+bre/q/y+FKnVwaEs= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BDA13858D3C ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fwCbQA+DUsMzmNL5CwJeOY2kq/RQICmJHXIr31bd85bcDogmM+4cOoXcegEBV8osF8LHmzSz6Ufc9CMT8b1zSZevRTJg/9zc7o+WQAfN0Sb+pmAGgStjVZfFtE5qMFysYgyayeozdObu2qSRjuF7xxCNUiiqa9Q/K4h2NmwhojzAAW4a48FoshlWosAKN3r47cVAuDBQjLHcYBG0rT4fN9uLtR3mNJyH6lZLL3XgHFo716eebenxHfXSiE3HVrnjp9PuYD6cmd4DmXUK63OazHFjvgzcQ8vkUKWY6tRa+9czIreHDbWGlen6jJanSNBsFAkpixren6PA1MESrDO/Rw== 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=seIyYS1QnGXwnuie8PM/m0hjezUExF4Yi+dZCPL0XvQ=; b=YeCTSkplBcqHN1EhBGxe4kLAxDY8/wOK0Qw31FomUQnginiQHC9voxjMxNvCuAbOrJzFCAtZEI0gjqDoef8zT4EdgbyPlpJQD6XsuvDzklWj+SR5bLRgfUSe6aFjEZy45sMYXf7StmuPfio4pEdA3Y0uV/MzDWaJcEQPPKbs0O/oJ/MWizNPfqTJ3N39wUdu5pBIUoeBd5IqoeJooFOvZkcXSGoGxXsDudK9g6DhbzAlcTsrKnkP+9y1eoxTxXMwM5UA8pjHm7MSAIVtF0PcieVUoZeQZNHcMYeZxb1WsgyTn0WQkac6iPsmTqJ2Ham3pQZRxqx/UkAy9kCeqmxl0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=htecgroup.com; dmarc=pass action=none header.from=htecgroup.com; dkim=pass header.d=htecgroup.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=htecgroup.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=seIyYS1QnGXwnuie8PM/m0hjezUExF4Yi+dZCPL0XvQ=; b=istKTXxfZgdAVornF/Kh6n+qPwliycXA6kQC37M30YWWOzCwRPw2XGJJWE9xfT4TDbglLEg9VkpnI/aMAxBpJ85YwyBw6oy+PzGtY7e86RfIO7ZPIXGNmWDHS0IMXf70Ome5Umdik3TXIc+A+gUhWY7lbA2iUmvX7XhpbeY4NT7Ea/oHFvnjParD5NwfCsMP+RdjsXqITVeVDyHfaMPrxRkB5r7g/2YrO/RIMHzfohR5MvR7yu5n9MJvhYXY554OFj9PjSV2TR7CPhUCRbYiWvt9Jbm3VYTH8xu1zZr9QEs6ONUck+R7qJ+gk0623YWZQ1jbZnO0FJ4S4imqMu2GBA== Received: from AS2PR09MB6462.eurprd09.prod.outlook.com (2603:10a6:20b:59a::13) by AS8PR09MB5970.eurprd09.prod.outlook.com (2603:10a6:20b:536::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.12; Wed, 26 Nov 2025 13:54:35 +0000 Received: from AS2PR09MB6462.eurprd09.prod.outlook.com ([fe80::744d:a6be:5b2d:d33d]) by AS2PR09MB6462.eurprd09.prod.outlook.com ([fe80::744d:a6be:5b2d:d33d%5]) with mapi id 15.20.9366.009; Wed, 26 Nov 2025 13:54:35 +0000 From: Jovan Dmitrovic To: "libc-alpha@sourceware.org" CC: Djordje Todorovic , Adhemerval Zanella Netto , "Maciej W . Rozycki" , Joseph Myers , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jovan Dmitrovic Subject: [PATCH v4 5/6] mips: Remove strcmp.S Thread-Topic: [PATCH v4 5/6] mips: Remove strcmp.S Thread-Index: AQHcXtwyKgYXQrTJ406Hdc1w4ktANw== Date: Wed, 26 Nov 2025 13:54:35 +0000 Message-ID: <20251126135011.60176-6-jovan.dmitrovic@htecgroup.com> References: <20251126135011.60176-1-jovan.dmitrovic@htecgroup.com> In-Reply-To: <20251126135011.60176-1-jovan.dmitrovic@htecgroup.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=htecgroup.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AS2PR09MB6462:EE_|AS8PR09MB5970:EE_ x-ms-office365-filtering-correlation-id: 90b13664-4e91-4a9b-1c42-08de2cf35544 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|1800799024|38070700021; x-microsoft-antispam-message-info: =?utf-8?q?RUaLOMgts23PZJXswLSekJ7ZiR0cYEY?= =?utf-8?q?HKpDPFxrReS3E/N/7eqVSymgs1prQph7BGBwafke1zptWQy6pM8hvXLLZn3+JQreq?= =?utf-8?q?8CLuGVG48w5ERmkG+U/i9sAvgHTwCB1/Uy7r/oo1BJ0P/M4JIoTHtzZmHXEVw/YtS?= =?utf-8?q?mQT0XyWATAxPYGMp9Ia///vuQIpFAzDTeYDEvxD5O7G99SIYpzkyl4SMlvpqbhdHc?= =?utf-8?q?28jHDsHLr5rARKF0Sh3QEQmHb31XdXh4O2zJdbJlhb6ICztbsnpHs19M64pdA0r8l?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?utf-8?q?mPlOLr9lHVbrzyPkjI7sZQfbQmxWo8oXX/qhxfiAgJ1P0HTmMV2g8Y+cbDihzuCpu?= =?utf-8?q?z+VOaqKYt1Olu1mveAxlySoHd9W76JLUPC/e7ORq4DzVGq2qu3adUYuiYY83Hw8DL?= =?utf-8?q?GybQrhQ6YDh71MbrOqAIger+DtzeyLCzlRh4rDWgLtNyGbuzP3nRFhbQ1jAyrDuBw?= =?utf-8?q?aVKkNcyGQS+rj0pTNTlAHagPUO6TvMJvQJbDMMwljLCpsKcy0ClfMCulQN8rQU0fi?= =?utf-8?q?7Z9mJIsvjdtgXxBKTFmAd0fhSxgXk3bthk4fSnFoQqjGTU8Hw8nnSqyitQQ7De/ti?= =?utf-8?q?R3oHZFF89J?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS2PR09MB6462.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?NmnJCJeU+LkWtEBFb8o5QSGw19Mq?= =?utf-8?q?imCBkqFZ5L5qLuO/K9Slg/+p3l0h5OYFii7P8N3nhTDtuHNUd/vxDM0Qrtyx7q5bp?= =?utf-8?q?tJqpfLUgO6oXzxX+QnydRM1eiB8jyO4rvM32th7vPbWzZrzaVOj4kXjUPTMDPQ9VV?= =?utf-8?q?cDbcGax+9sDhmT40N5Q9vfdcW/f1tNCAbTRkoIy/opmZAZTOhlJ3cszOXVV//+79V?= =?utf-8?q?qNULeN+tcTHsQwxEwYUlIQHekhTGKPOfMSvHnGz3zmWouhpZmziZuQB4DzZGsuqy1?= =?utf-8?q?uccltGenM5T8hI0rI2JVpyjxEn/oyxmdUi9ZRWLhzq/2dw5VeL7oBOGGkNyf/LST7?= =?utf-8?q?/RsDyU/7XR0v4HldHh9m61o6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pJ88qOUX+HBJC3CgJNQaH/bdz1rtOMduy?= =?utf-8?q?/qag1dILVhMNm7Ga6T5G4/U5y6vPDu1wh8tKzzdIKNvIvPjzr7DuUMH9ykYROd9Os?= =?utf-8?q?cMTCb0rwFMjEMaBD6URpNLhha7ll136Kg0+MKYkGUfJpIO6Agc53A88VUJcWekDGW?= =?utf-8?q?77alzI/Y6NZkDp4OexvSuSLpmqOM4qJMihhfYmwZllPRI4ZJFB3xE2lo1oD/rt7Ze?= =?utf-8?q?Ors8ITB5PxhhdnUpr4w6Hy+Xgh+tswTjUcLywV7O//O2OKtlf3NCQWmhbwzDhZnOK?= =?utf-8?q?tLjVF8Sl71paZ0NZ6rfi16jmPYANG7o+q8pHGKqC/OWKGFUszY7TC0c=3D?= Content-ID: <15BAE31D9C523B438C18CA83D4297427@eurprd09.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: htecgroup.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS2PR09MB6462.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90b13664-4e91-4a9b-1c42-08de2cf35544 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2025 13:54:35.2273 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9f85665b-7efd-4776-9dfe-b6bfda2565ee X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lnN2o3v/VlJkSgq+xWI5NhqOPLxIsVnqAS+f/8+QU4Ogn2gE8csdt0aca3ICIxSL+dSm5ukrwpxmdTFmv4wJawgOiUIc56cfb7MMZYvlY6Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR09MB5970 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_PASS, TXREP 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: 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 Testing strcmp on MIPS hardware shows that strcmp.S performs worse than the combination of using the generic strcmp.c implementation alongside -funroll-loops. Suggested-by: Joseph Myers Reviewed-by: Adhemerval Zanella Reviewed-by: Philippe Mathieu-Daudé --- sysdeps/mips/Makefile | 4 + sysdeps/mips/strcmp.S | 249 ------------------------------------------ 2 files changed, 4 insertions(+), 249 deletions(-) delete mode 100644 sysdeps/mips/strcmp.S -- 2.34.1 diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile index d189973aa0..c86bd3af33 100644 --- a/sysdeps/mips/Makefile +++ b/sysdeps/mips/Makefile @@ -17,6 +17,10 @@ CPPFLAGS-crti.S += $(pic-ccflag) CPPFLAGS-crtn.S += $(pic-ccflag) endif +ifeq ($(subdir),string) +CFLAGS-strcmp.c += -funroll-loops +endif + ASFLAGS-.os += $(pic-ccflag) # libc.a and libc_p.a must be compiled with -fPIE/-fpie for static PIE. ASFLAGS-.o += $(pie-default) diff --git a/sysdeps/mips/strcmp.S b/sysdeps/mips/strcmp.S deleted file mode 100644 index b599d5d7ec..0000000000 --- a/sysdeps/mips/strcmp.S +++ /dev/null @@ -1,249 +0,0 @@ -/* Copyright (C) 2014-2025 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 - . */ - -#ifdef ANDROID_CHANGES -# include "machine/asm.h" -# include "machine/regdef.h" -#elif _LIBC -# include -# include -# include -#elif defined _COMPILING_NEWLIB -# include "machine/asm.h" -# include "machine/regdef.h" -#else -# include -# include -#endif - -/* Technically strcmp should not read past the end of the strings being - compared. We will read a full word that may contain excess bits beyond - the NULL string terminator but unless ENABLE_READAHEAD is set, we will not - read the next word after the end of string. Setting ENABLE_READAHEAD will - improve performance but is technically illegal based on the definition of - strcmp. */ -#ifdef ENABLE_READAHEAD -# define DELAY_READ -#else -# define DELAY_READ nop -#endif - -/* Testing on a little endian machine showed using CLZ was a - performance loss, so we are not turning it on by default. */ -#if defined(ENABLE_CLZ) && (__mips_isa_rev > 1) -# define USE_CLZ -#endif - -/* Some asm.h files do not have the L macro definition. */ -#ifndef L -# if _MIPS_SIM == _ABIO32 -# define L(label) $L ## label -# else -# define L(label) .L ## label -# endif -#endif - -/* Some asm.h files do not have the PTR_ADDIU macro definition. */ -#ifndef PTR_ADDIU -# ifdef USE_DOUBLE -# define PTR_ADDIU daddiu -# else -# define PTR_ADDIU addiu -# endif -#endif - -/* Allow the routine to be named something else if desired. */ -#ifndef STRCMP_NAME -# define STRCMP_NAME strcmp -#endif - -#ifdef ANDROID_CHANGES -LEAF(STRCMP_NAME, 0) -#else -LEAF(STRCMP_NAME) -#endif - .set nomips16 - .set noreorder - - or t0, a0, a1 - andi t0,0x3 - bne t0, zero, L(byteloop) - -/* Both strings are 4 byte aligned at this point. */ - - lui t8, 0x0101 - ori t8, t8, 0x0101 - lui t9, 0x7f7f - ori t9, 0x7f7f - -#define STRCMP32(OFFSET) \ - lw v0, OFFSET(a0); \ - lw v1, OFFSET(a1); \ - subu t0, v0, t8; \ - bne v0, v1, L(worddiff); \ - nor t1, v0, t9; \ - and t0, t0, t1; \ - bne t0, zero, L(returnzero) - -L(wordloop): - STRCMP32(0) - DELAY_READ - STRCMP32(4) - DELAY_READ - STRCMP32(8) - DELAY_READ - STRCMP32(12) - DELAY_READ - STRCMP32(16) - DELAY_READ - STRCMP32(20) - DELAY_READ - STRCMP32(24) - DELAY_READ - STRCMP32(28) - PTR_ADDIU a0, a0, 32 - b L(wordloop) - PTR_ADDIU a1, a1, 32 - -L(returnzero): - j ra - move v0, zero - -L(worddiff): -#ifdef USE_CLZ - subu t0, v0, t8 - nor t1, v0, t9 - and t1, t0, t1 - xor t0, v0, v1 - or t0, t0, t1 -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - wsbh t0, t0 - rotr t0, t0, 16 -# endif - clz t1, t0 - and t1, 0xf8 -# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - neg t1 - addu t1, 24 -# endif - rotrv v0, v0, t1 - rotrv v1, v1, t1 - and v0, v0, 0xff - and v1, v1, 0xff - j ra - subu v0, v0, v1 -#else /* USE_CLZ */ -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - andi t0, v0, 0xff - beq t0, zero, L(wexit01) - andi t1, v1, 0xff - bne t0, t1, L(wexit01) - - srl t8, v0, 8 - srl t9, v1, 8 - andi t8, t8, 0xff - beq t8, zero, L(wexit89) - andi t9, t9, 0xff - bne t8, t9, L(wexit89) - - srl t0, v0, 16 - srl t1, v1, 16 - andi t0, t0, 0xff - beq t0, zero, L(wexit01) - andi t1, t1, 0xff - bne t0, t1, L(wexit01) - - srl t8, v0, 24 - srl t9, v1, 24 -# else /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */ - srl t0, v0, 24 - beq t0, zero, L(wexit01) - srl t1, v1, 24 - bne t0, t1, L(wexit01) - - srl t8, v0, 16 - srl t9, v1, 16 - andi t8, t8, 0xff - beq t8, zero, L(wexit89) - andi t9, t9, 0xff - bne t8, t9, L(wexit89) - - srl t0, v0, 8 - srl t1, v1, 8 - andi t0, t0, 0xff - beq t0, zero, L(wexit01) - andi t1, t1, 0xff - bne t0, t1, L(wexit01) - - andi t8, v0, 0xff - andi t9, v1, 0xff -# endif /* __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ */ - -L(wexit89): - j ra - subu v0, t8, t9 -L(wexit01): - j ra - subu v0, t0, t1 -#endif /* USE_CLZ */ - -/* It might seem better to do the 'beq' instruction between the two 'lbu' - instructions so that the nop is not needed but testing showed that this - code is actually faster (based on glibc strcmp test). */ -#define BYTECMP01(OFFSET) \ - lbu v0, OFFSET(a0); \ - lbu v1, OFFSET(a1); \ - beq v0, zero, L(bexit01); \ - nop; \ - bne v0, v1, L(bexit01) - -#define BYTECMP89(OFFSET) \ - lbu t8, OFFSET(a0); \ - lbu t9, OFFSET(a1); \ - beq t8, zero, L(bexit89); \ - nop; \ - bne t8, t9, L(bexit89) - -L(byteloop): - BYTECMP01(0) - BYTECMP89(1) - BYTECMP01(2) - BYTECMP89(3) - BYTECMP01(4) - BYTECMP89(5) - BYTECMP01(6) - BYTECMP89(7) - PTR_ADDIU a0, a0, 8 - b L(byteloop) - PTR_ADDIU a1, a1, 8 - -L(bexit01): - j ra - subu v0, v0, v1 -L(bexit89): - j ra - subu v0, t8, t9 - - .set at - .set reorder - -END(STRCMP_NAME) -#ifndef ANDROID_CHANGES -# ifdef _LIBC -libc_hidden_builtin_def (STRCMP_NAME) -# endif -#endif