From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85667 invoked by alias); 6 Sep 2019 16:55:28 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 85654 invoked by uid 89); 6 Sep 2019 16:55:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-19.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LOTSOFHASH,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-19.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LOTSOFHASH,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr50084.outbound.protection.outlook.com (HELO EUR03-VE1-obe.outbound.protection.outlook.com) (40.107.5.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 16:55:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R1fNbtlrutiYrNIG2ao/Sr2Mucg1l4yXb4xWU3RPD8I=; b=7UhXj1TElP1yIPFWB8Y2Ym307ThviYFboe+MrWy+ZwVg2iBLxnEIzouf4db+4pWkH1fi1XbhFk/14nX9eynvWl5GkCdXJ5oME5FG60Ejud7pnjjHLtPMDxsz9Kc6EkQKP7L2/mvdC7VDwtPs+kRW/4vjicgk1UJDjCSr88vFbDo= Received: from HE1PR08CA0069.eurprd08.prod.outlook.com (2603:10a6:7:2a::40) by VE1PR08MB4864.eurprd08.prod.outlook.com (2603:10a6:802:a7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.19; Fri, 6 Sep 2019 16:55:21 +0000 Received: from VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::202) by HE1PR08CA0069.outlook.office365.com (2603:10a6:7:2a::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.13 via Frontend Transport; Fri, 6 Sep 2019 16:55:21 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT007.mail.protection.outlook.com (10.152.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2241.14 via Frontend Transport; Fri, 6 Sep 2019 16:55:19 +0000 Received: ("Tessian outbound aa6cb5c8f945:v27"); Fri, 06 Sep 2019 16:55:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6655cf1bed7fb628 X-CR-MTA-TID: 64aa7808 Received: from e69651fca9b7.1 (cr-mta-lb-1.cr-mta-net [104.47.9.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id AAA3164A-2FA1-48BF-80D3-2C6B8C7D34C3.1; Fri, 06 Sep 2019 16:55:13 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp2056.outbound.protection.outlook.com [104.47.9.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e69651fca9b7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 06 Sep 2019 16:55:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MC6TVXz4lWhgyH+Ds2V1oktomaJRfBUc+KDtQOG9k7N8N7dKMPsyJKGq3hCbNSAZT28xVmtp4nXklXCbqlh1ShIn6+7tqwsb+btaBx3AUx0Yk8gCL3gJcVR52prbmzm5gpKwJf6XV8iS3F8+S0SstVJoghw42OO75JQXIs8j5LkyvJhl7APGiKcST5Oa9bYpU9L/ZhJGEYpGvBDUU1U1+NFRcVTy4qyFIgxkxDnvFoOV4KXmMznybFASaHg4HyU7EA9+Mk76P/U5Qduw26tUUOZpEshU18JP7QkFk0JBC6N2eAYl9FLTAUcor04n/zpcLylaQLdNIUHeXCordZe1rw== 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=R1fNbtlrutiYrNIG2ao/Sr2Mucg1l4yXb4xWU3RPD8I=; b=n+hqkawuoCNve/sOOVVD2jCo1rZxOZQH4ml4WA4SMMOLQY9pP2Vd05yuHYkM1uxKj7QndQ8e6XXCvycQ46ejif8UPxEQQTW1LGVmr/Mlizud8hOmeUJhyxoEnRJv5KeUFoAC621uDH+ksOrGx2S+bLEOo43TkUDkTVP30QGmiDCpgGaPxYP/4TliE3+vi763roQeT99PUAxLepwNEF2Zaf0Kuiqr2n0ZvAzIqs2YgzM98uTxv8X+EEc2Xz8wcJGggp3Vyp3I2C0ee/du3OKKOz7wsDiGRb64EslGRx7jSTdLXeuX2TzfquJA2FIvJZaIsM6EL9FfRsMMD3KCWL6aOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R1fNbtlrutiYrNIG2ao/Sr2Mucg1l4yXb4xWU3RPD8I=; b=7UhXj1TElP1yIPFWB8Y2Ym307ThviYFboe+MrWy+ZwVg2iBLxnEIzouf4db+4pWkH1fi1XbhFk/14nX9eynvWl5GkCdXJ5oME5FG60Ejud7pnjjHLtPMDxsz9Kc6EkQKP7L2/mvdC7VDwtPs+kRW/4vjicgk1UJDjCSr88vFbDo= Received: from VI1PR0801MB2127.eurprd08.prod.outlook.com (10.168.62.22) by VI1PR0801MB2109.eurprd08.prod.outlook.com (10.173.74.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.19; Fri, 6 Sep 2019 16:55:12 +0000 Received: from VI1PR0801MB2127.eurprd08.prod.outlook.com ([fe80::7c75:98da:fbc1:da02]) by VI1PR0801MB2127.eurprd08.prod.outlook.com ([fe80::7c75:98da:fbc1:da02%11]) with mapi id 15.20.2241.018; Fri, 6 Sep 2019 16:55:12 +0000 From: Wilco Dijkstra To: "libc-stable@sourceware.org" CC: nd Subject: [2.26 COMMITTED][AArch64] Backport strncmp improvements Thread-Topic: [2.26 COMMITTED][AArch64] Backport strncmp improvements Thread-Index: AQHVZNOliOkZMr9ukkmfcbKB0pAhOg== Date: Tue, 01 Jan 2019 00:00:00 -0000 Message-ID: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-originating-ip: [217.140.106.54] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 608e68f4-9682-4e9d-72ad-08d732eaffea X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VI1PR0801MB2109; X-MS-TrafficTypeDiagnostic: VI1PR0801MB2109:|VE1PR08MB4864: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:5797;OLM:5797; x-forefront-prvs: 0152EBA40F X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(376002)(366004)(136003)(39860400002)(396003)(346002)(54534003)(189003)(199004)(186003)(26005)(316002)(7696005)(102836004)(6506007)(74316002)(305945005)(7736002)(2501003)(8676002)(4326008)(99286004)(81156014)(25786009)(81166006)(8936002)(5640700003)(256004)(14444005)(55016002)(66066001)(6436002)(71190400001)(71200400001)(486006)(476003)(9686003)(53936002)(14454004)(6916009)(33656002)(6116002)(3846002)(2906002)(86362001)(66556008)(66476007)(66946007)(2351001)(478600001)(66446008)(76116006)(52536014)(5660300002)(64756008)(219204002)(40753002)(133343001)(357404004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0801MB2109;H:VI1PR0801MB2127.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: zIdk8afdP9qBaHGPHuRHEKxQEQzLo9GMd+rEjBmxTBrb4+MXhsWIKQdCBdvdjkURvzTy+ImU7AfKBlii2jsFlTYtbW53KBTowstb8oRicJLXFGDNNMZbUupRkIwBNx3CpDF2kbEybrHQ9Ect3RrLLKIlZHE6r2iKnc+wFcgsmv3afZfVlgS9jq0Ea2tnmTZebsbuvmHE2vAwzkT124gj7mvUwb/daSSTdoHAMc8qYUd5nUEF3PZX/d8e3JVNOTnD4xqFQ2nvLjyZjNbnHitZ0fjRgzjy7d94vxLMMO5bYcS/X+dM71nfv2YTzNAQHAIEuuV6yGM+GylVwtMI7LM89aaIEj/OdXKa40/fz7mXpMR7Vk714JyiZVjNaDUa7mdJJFjPni6FpqlUyfcQPdV7XcLvvikATubqqmhud9MiO4s= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2109 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(136003)(346002)(396003)(376002)(2980300002)(54534003)(189003)(199004)(5640700003)(33656002)(14444005)(5660300002)(47776003)(66066001)(6116002)(9686003)(3846002)(55016002)(63350400001)(22756006)(7696005)(2906002)(70586007)(86362001)(81156014)(81166006)(74316002)(316002)(36906005)(7736002)(8676002)(8746002)(70206006)(50466002)(305945005)(26826003)(2351001)(126002)(102836004)(14454004)(26005)(476003)(478600001)(2501003)(6506007)(6916009)(23756003)(4326008)(486006)(63370400001)(25786009)(52536014)(99286004)(8936002)(186003)(76130400001)(356004)(336012)(219204002)(40753002)(133343001)(357404004);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB4864;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 82bdeb56-e9fb-4e54-4d35-08d732eafbd3 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(710020)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:VE1PR08MB4864; NoDisclaimer: True X-Forefront-PRVS: 0152EBA40F X-Microsoft-Antispam-Message-Info: cM844jrYuNQP3uAxaWWgd/GR+MF9E1EvJbSjUI8n7PqXTb+FGDzlybdd+oleZV04cAgDniHFMDQnFSIIlNdRcSs0CZojogfTDXOVUbfox0X6uDPWewYfI4onND/z7YMFgArRH/dSG2JpiKOx0g47paePG3BzAfR2PvEnMkNmAi7ua4/WkIoKMQW6wbWU/gkwt4EEBkGW1y4GHunqjd9FRHaVWKBS60sb8axQDIZtuLaGTT7QsgOMl5OxMW8UxyKAr/ovItpFM9b2K3yF21+NDHQgOVRdT/bz/As1X8Djxj8EBzwKeC6U+dLZ96pdGpa2O7XDLGhAQV6Ll+iGQtiZQBgYk83+IY9wgnqFPIRxir2rsdEW4NUk+tjo4UsIw1EHY1eAlVeTLxTkT8oEjZNA9TIgvOs0GHP6FjEIvm5DpqU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2019 16:55:19.2124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 608e68f4-9682-4e9d-72ad-08d732eaffea 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4864 X-SW-Source: 2019-09/txt/msg00009.txt.bz2 commit e3c35100d32f83aa3c0ec57b83746fea9b98bc2f Author: Siddhesh Poyarekar Date: Thu Mar 15 08:06:21 2018 +0530 aarch64/strncmp: Use lsr instead of mov+lsr =20=20=20=20 A lsr can do what the mov and lsr did. =20=20=20=20 (cherry picked from commit b47c3e7637efb77818cbef55dcd0ed1f0ea0ddf1) commit 00fd3acde1475e1bc488ee13ae124d0340da856e Author: Siddhesh Poyarekar Date: Wed Mar 14 18:51:05 2018 +0530 aarch64/strncmp: Unbreak builds with old binutils =20=20=20=20 Binutils 2.26.* and older do not support moves with shifted registers, so use a separate shift instruction instead. =20=20=20=20 (cherry picked from commit d46f84de745db8f3f06a37048261f4e5ceacf0a3) commit af9381b734e2218f84235e000cd20d2824a6ed42 Author: Siddhesh Poyarekar Date: Tue Mar 13 23:57:03 2018 +0530 aarch64: Improve strncmp for mutually misaligned inputs =20=20=20=20 The mutually misaligned inputs on aarch64 are compared with a simple byte copy, which is not very efficient. Enhance the comparison similar to strcmp by loading a double-word at a time. The peak performance improvement (i.e. 4k maxlen comparisons) due to this on the strncmp microbenchmark is as follows: =20=20=20=20 falkor: 3.5x (up to 72% time reduction) cortex-a73: 3.5x (up to 71% time reduction) cortex-a53: 3.5x (up to 71% time reduction) =20=20=20=20 All mutually misaligned inputs from 16 bytes maxlen onwards show upwards of 15% improvement and there is no measurable effect on the performance of aligned/mutually aligned inputs. =20=20=20=20 * sysdeps/aarch64/strncmp.S (count): New macro. (strncmp): Store misaligned length in SRC1 in COUNT. (mutual_align): Adjust. (misaligned8): Load dword at a time when it is safe. =20=20=20=20 (cherry picked from commit 7108f1f944792ac68332967015d5e6418c5ccc88) diff --git a/ChangeLog b/ChangeLog index 29f9e1b..e9557b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2019-09-06 Siddhesh Poyarekar =20 + * sysdeps/aarch64/strncmp.S (strncmp): Use lsr instead of + mov + lsr. + +2019-09-06 Siddhesh Poyarekar + + * sysdeps/aarch64/strncmp.S (strncmp): Use a separate shift + instruction to unbreak builds with binutils 2.26 and older. + +2019-09-06 Siddhesh Poyarekar + + * sysdeps/aarch64/strncmp.S (count): New macro. + (strncmp): Store misaligned length in SRC1 in COUNT. + (mutual_align): Adjust. + (misaligned8): Load dword at a time when it is safe. + +2019-09-06 Siddhesh Poyarekar + * sysdeps/aarch64/strcmp.S (do_misaligned): Jump back to do_misaligned, not misaligned8. =20 diff --git a/sysdeps/aarch64/strncmp.S b/sysdeps/aarch64/strncmp.S index 3e4d88a..fc1f633 100644 --- a/sysdeps/aarch64/strncmp.S +++ b/sysdeps/aarch64/strncmp.S @@ -49,6 +49,7 @@ #define limit_wd x13 #define mask x14 #define endloop x15 +#define count mask =20 ENTRY_ALIGN_AND_PAD (strncmp, 6, 7) DELOUSE (0) @@ -58,9 +59,9 @@ ENTRY_ALIGN_AND_PAD (strncmp, 6, 7) eor tmp1, src1, src2 mov zeroones, #REP8_01 tst tmp1, #7 + and count, src1, #7 b.ne L(misaligned8) - ands tmp1, src1, #7 - b.ne L(mutual_align) + cbnz count, L(mutual_align) /* Calculate the number of full and partial words -1. */ sub limit_wd, limit, #1 /* limit !=3D 0, so no underflow. = */ lsr limit_wd, limit_wd, #3 /* Convert to Dwords. */ @@ -165,43 +166,107 @@ L(mutual_align): bic src1, src1, #7 bic src2, src2, #7 ldr data1, [src1], #8 - neg tmp3, tmp1, lsl #3 /* 64 - bits(bytes beyond align). */ + neg tmp3, count, lsl #3 /* 64 - bits(bytes beyond align). */ ldr data2, [src2], #8 mov tmp2, #~0 sub limit_wd, limit, #1 /* limit !=3D 0, so no underflow. = */ #ifdef __AARCH64EB__ /* Big-endian. Early bytes are at MSB. */ - lsl tmp2, tmp2, tmp3 /* Shift (tmp1 & 63). */ + lsl tmp2, tmp2, tmp3 /* Shift (count & 63). */ #else /* Little-endian. Early bytes are at LSB. */ - lsr tmp2, tmp2, tmp3 /* Shift (tmp1 & 63). */ + lsr tmp2, tmp2, tmp3 /* Shift (count & 63). */ #endif and tmp3, limit_wd, #7 lsr limit_wd, limit_wd, #3 /* Adjust the limit. Only low 3 bits used, so overflow irrelevant. = */ - add limit, limit, tmp1 - add tmp3, tmp3, tmp1 + add limit, limit, count + add tmp3, tmp3, count orr data1, data1, tmp2 orr data2, data2, tmp2 add limit_wd, limit_wd, tmp3, lsr #3 b L(start_realigned) =20 -L(ret0): - mov result, #0 - RET - .p2align 6 + /* Don't bother with dwords for up to 16 bytes. */ L(misaligned8): - sub limit, limit, #1 -1: + cmp limit, #16 + b.hs L(try_misaligned_words) + +L(byte_loop): /* Perhaps we can do better than this. */ ldrb data1w, [src1], #1 ldrb data2w, [src2], #1 subs limit, limit, #1 - ccmp data1w, #1, #0, cs /* NZCV =3D 0b0000. */ + ccmp data1w, #1, #0, hi /* NZCV =3D 0b0000. */ ccmp data1w, data2w, #0, cs /* NZCV =3D 0b0000. */ - b.eq 1b + b.eq L(byte_loop) +L(done): sub result, data1, data2 RET + + /* Align the SRC1 to a dword by doing a bytewise compare and then do + the dword loop. */ +L(try_misaligned_words): + lsr limit_wd, limit, #3 + cbz count, L(do_misaligned) + + neg count, count + and count, count, #7 + sub limit, limit, count + lsr limit_wd, limit, #3 + +L(page_end_loop): + ldrb data1w, [src1], #1 + ldrb data2w, [src2], #1 + cmp data1w, #1 + ccmp data1w, data2w, #0, cs /* NZCV =3D 0b0000. */ + b.ne L(done) + subs count, count, #1 + b.hi L(page_end_loop) + +L(do_misaligned): + /* Prepare ourselves for the next page crossing. Unlike the aligned + loop, we fetch 1 less dword because we risk crossing bounds on + SRC2. */ + mov count, #8 + subs limit_wd, limit_wd, #1 + b.lo L(done_loop) +L(loop_misaligned): + and tmp2, src2, #0xff8 + eor tmp2, tmp2, #0xff8 + cbz tmp2, L(page_end_loop) + + ldr data1, [src1], #8 + ldr data2, [src2], #8 + sub tmp1, data1, zeroones + orr tmp2, data1, #REP8_7f + eor diff, data1, data2 /* Non-zero if differences found. = */ + bics has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */ + ccmp diff, #0, #0, eq + b.ne L(not_limit) + subs limit_wd, limit_wd, #1 + b.pl L(loop_misaligned) + +L(done_loop): + /* We found a difference or a NULL before the limit was reached. */ + and limit, limit, #7 + cbz limit, L(not_limit) + /* Read the last word. */ + sub src1, src1, 8 + sub src2, src2, 8 + ldr data1, [src1, limit] + ldr data2, [src2, limit] + sub tmp1, data1, zeroones + orr tmp2, data1, #REP8_7f + eor diff, data1, data2 /* Non-zero if differences found. = */ + bics has_nul, tmp1, tmp2 /* Non-zero if NUL terminator. */ + ccmp diff, #0, #0, eq + b.ne L(not_limit) + +L(ret0): + mov result, #0 + RET + END (strncmp) libc_hidden_builtin_def (strncmp)