From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73550 invoked by alias); 6 Sep 2019 16:47:36 -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 73539 invoked by uid 89); 6 Sep 2019 16:47:36 -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.6 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=peak X-Spam-Status: No, score=-19.6 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: EUR02-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr10045.outbound.protection.outlook.com (HELO EUR02-HE1-obe.outbound.protection.outlook.com) (40.107.1.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 16:47:32 +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=lepS4sfy+o8i2oCnRFMxjaXe8lrvo2MnVsNNic1+4tA=; b=5wN9s4v+5QWCIkLEpWYgQSOhp0Hn5v5DUqvV5cGnvuVaxHtVD06c2QdleltLbRW+XRJqI0gzkswwfZpdzbU6j5+qO3CAiOkXiU//2I2dM/o6Fiqqb3f1/Q7s8Jap9kQl4/jC8SbRPXNWBpif33++cCN6DVPhQjk2N9Ar/iq2FcA= Received: from DB6PR0801CA0048.eurprd08.prod.outlook.com (2603:10a6:4:2b::16) by DB7PR08MB3338.eurprd08.prod.outlook.com (2603:10a6:5:1b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.20; Fri, 6 Sep 2019 16:47:28 +0000 Received: from VE1EUR03FT045.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::207) by DB6PR0801CA0048.outlook.office365.com (2603:10a6:4:2b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.14 via Frontend Transport; Fri, 6 Sep 2019 16:47:28 +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 VE1EUR03FT045.mail.protection.outlook.com (10.152.19.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.14 via Frontend Transport; Fri, 6 Sep 2019 16:47:26 +0000 Received: ("Tessian outbound f83cc93ed55d:v27"); Fri, 06 Sep 2019 16:47:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e4e981894da9d45a X-CR-MTA-TID: 64aa7808 Received: from 9109883ba17b.1 (cr-mta-lb-1.cr-mta-net [104.47.13.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id CE5EFE34-7C26-4AF1-9E7E-27EEA288FD81.1; Fri, 06 Sep 2019 16:47:21 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04lp2056.outbound.protection.outlook.com [104.47.13.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9109883ba17b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 06 Sep 2019 16:47:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VfD6DQ606e2QGtlvz0kkB5YtZUVhuaplbWtWkSRFmqjqL0EGngckXeBM1Zh0FpxZhW1/C3p8TrztRLTZHnv2PhshCPee3/y9n3NxhxsHHHABMaaPi1xkygMO6tPelyh1hzdZXBDTyKZ7Hi3HLC7a0Yl9PP4G4hlpjkLel/NQxbv+i4D44E2uzPYVmoHedZafxedtoxlWLOIsmIbSC5hyI5bddWAkT15PYg7mOpnGq3IAj+2rMFz5dkm5oSmw25e1jkedfeWBEfwhpakaKEiaoqg4cdvPQPn36vgdyvFtSylgygRT4YvGSUv1iraN64Sxhf5OXqlXRiPtnKBf4gcHPQ== 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=lepS4sfy+o8i2oCnRFMxjaXe8lrvo2MnVsNNic1+4tA=; b=GNRVQ+ta/PF6+76Dvsluqs1K3gBSJg/OeO7SC2VySdwwTaRxVRSsO2AIRcf/nq7cPV189kACNER5xURSr2pk3BDT/yeq5UYCWv6fTxsMkvY+GVKCeGzfK19RMieDsT36QkGUJ4NckGB41eORL5u+zDYbeAiposOVyJ3bhGI0xECX51lvAp/yVzhmCI/lisl3AbagDtmmFfAibL+fxVp7+UgxpedjNlwlLCQiXGctbF3lR4roHRPl3YdMpulqmjRvlu8K6zf96pKTRJvDai/eLXvZw238EEvNCroo5j4mRgdKdOvBDnvS8ZurvH5EVTv/i4aGKELpula3Q8TMlqelVw== 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=lepS4sfy+o8i2oCnRFMxjaXe8lrvo2MnVsNNic1+4tA=; b=5wN9s4v+5QWCIkLEpWYgQSOhp0Hn5v5DUqvV5cGnvuVaxHtVD06c2QdleltLbRW+XRJqI0gzkswwfZpdzbU6j5+qO3CAiOkXiU//2I2dM/o6Fiqqb3f1/Q7s8Jap9kQl4/jC8SbRPXNWBpif33++cCN6DVPhQjk2N9Ar/iq2FcA= Received: from VI1PR0801MB2127.eurprd08.prod.outlook.com (10.168.62.22) by VI1PR0801MB2126.eurprd08.prod.outlook.com (10.168.62.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.20; Fri, 6 Sep 2019 16:47:19 +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:47:19 +0000 From: Wilco Dijkstra To: "libc-stable@sourceware.org" CC: nd Subject: [2.27 COMMITTED][AArch64] Backport strncmp improvements Thread-Topic: [2.27 COMMITTED][AArch64] Backport strncmp improvements Thread-Index: AQHVZNKNB4wv/zrovE6t61wvA293Gw== 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: be9bb3b2-eedd-4881-cb48-08d732e9e64d 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:VI1PR0801MB2126; X-MS-TrafficTypeDiagnostic: VI1PR0801MB2126:|DB7PR08MB3338: 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)(396003)(376002)(39860400002)(346002)(366004)(136003)(54534003)(199004)(189003)(14454004)(71200400001)(6916009)(71190400001)(478600001)(102836004)(53936002)(55016002)(14444005)(256004)(486006)(66066001)(5640700003)(7696005)(186003)(26005)(6506007)(86362001)(476003)(9686003)(6436002)(76116006)(5660300002)(3846002)(6116002)(33656002)(66476007)(66556008)(25786009)(52536014)(316002)(66946007)(2906002)(64756008)(66446008)(8936002)(99286004)(81166006)(81156014)(8676002)(305945005)(2351001)(2501003)(7736002)(4326008)(74316002)(219204002)(40753002)(133343001)(357404004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0801MB2126;H:VI1PR0801MB2127.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: WZkjtn3Dg+HdXDTvFRrn9UkcVXxHaP+Tm9MgenRFkFj5I6DqA9zr1RjE5o2um9FizutNgykKpzPkDTL52P4u3QUVoxJiJFWDyp3AWNU7Yrp12WYdbjm9XBTh0LVW2cKoH+0kuR6QS2HrYuAGkfwAgkqeDUpJDfBzEk7RaH9ySQvj9sPTZvrHH1a+3xHx8szQNgvOEDt8IbsHTIpM/TOGLBiNVCfkN58FDOwnBz2b07Ef9kCJfEoUuNWDS00gePUdUs6zR9s/rqyWBlOY4YqJuiFiUrzwPeapccUixLws8k51hbROZDpKzH+pfNXkmXD+U2fZIOzgxkf8+tX9z4yO6DuHw0qgNVLSZpLfw5c869Lf2qqYB72D9qskEV9bGWJYgwP9JzR/tGsFbQspd4xVBR53XPRlWADEuwLguJc7QhA= 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: VI1PR0801MB2126 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT045.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)(376002)(346002)(136003)(396003)(2980300002)(54534003)(189003)(199004)(486006)(33656002)(126002)(316002)(63370400001)(476003)(36906005)(70586007)(22756006)(63350400001)(52536014)(70206006)(356004)(7736002)(86362001)(5660300002)(81156014)(8746002)(76130400001)(50466002)(47776003)(8936002)(25786009)(4326008)(8676002)(81166006)(14444005)(66066001)(2351001)(3846002)(6116002)(2906002)(6916009)(14454004)(26826003)(9686003)(478600001)(23756003)(305945005)(336012)(186003)(26005)(55016002)(102836004)(7696005)(5640700003)(99286004)(74316002)(6506007)(2501003)(219204002)(40753002)(133343001)(357404004);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR08MB3338;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: bc44fd14-4a70-4564-5342-08d732e9e204 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(710020)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:DB7PR08MB3338; NoDisclaimer: True X-Forefront-PRVS: 0152EBA40F X-Microsoft-Antispam-Message-Info: vxlRymSfHkPup00xlGyxbTSkEKqKn9daD8wxNYJQ+3OI3NO7VVF9ge3zEEWqkZBeyQhX0gzpd9Z2Zd0fKBs++2ncp4yzOIVOg98uuP3TQO9AcKYF+BN+A98UGuvN+Fm7w8ySDi4xVQYDtyn3Iv1zRKCxI5LkLg4rpXQD3ph1dbdAQm49BgbYTTtIb0ygPgED72bYsU/4IWeq2wLI4MXZsb2R2rTuegIQnC7pCAB+q/XwvTSPVFDUrPDu8m7ydZ8vNGj3rNcGW8VKPLVnkdTSecHyc1CVBkEAvVAYI25FK+8FNoKh2YHRGxDKn3/+VV7MPBqSudn0MTqcS+4Tn0NKhMUc7hp/QZiyH5KMXE5+JcIa+lDVhj+qmTC3Iw95j/j1FmZwYNoGpwwIfureMaECr323n1H1I9KtR0ItjVFOnDU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2019 16:47:26.7099 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be9bb3b2-eedd-4881-cb48-08d732e9e64d 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: DB7PR08MB3338 X-SW-Source: 2019-09/txt/msg00006.txt.bz2 commit 0fc5934ebd13ee4e1c12224d0e9206b76d10c626 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 e0a0bd3accf5837d8fa6b6907923c13b9ac0e0ff 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 638caf300022aab68f4c464f57e8b8ac879f5735 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 5ddc3e7..99b6180 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 a08d2c0..759c752 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)