From patchwork Wed Apr 15 13:32:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhuyan (M)" X-Patchwork-Id: 38816 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from huawei.com (szxga03-in.huawei.com [45.249.212.189]) by sourceware.org (Postfix) with ESMTPS id 4F274384BC04 for ; Wed, 15 Apr 2020 13:32:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F274384BC04 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zhuyan34@huawei.com Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id AB0436B8C1A7FA382F44 for ; Wed, 15 Apr 2020 21:32:06 +0800 (CST) Received: from dggeme712-chm.china.huawei.com (10.1.199.108) by DGGEMM401-HUB.china.huawei.com (10.3.20.209) with Microsoft SMTP Server (TLS) id 14.3.487.0; Wed, 15 Apr 2020 21:32:06 +0800 Received: from dggeme762-chm.china.huawei.com (10.3.19.108) by dggeme712-chm.china.huawei.com (10.1.199.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 15 Apr 2020 21:32:06 +0800 Received: from dggeme762-chm.china.huawei.com ([10.8.68.53]) by dggeme762-chm.china.huawei.com ([10.8.68.53]) with mapi id 15.01.1713.004; Wed, 15 Apr 2020 21:32:06 +0800 From: "zhuyan (M)" To: "libc-alpha@sourceware.org" Subject: [PATCH] aarch64: Revert "aarch64: Optimized implementation of strnlen" [BZ #25825] Thread-Topic: [PATCH] aarch64: Revert "aarch64: Optimized implementation of strnlen" [BZ #25825] Thread-Index: AdYTKjvw0St8JDqtTiG828jvN7yM9w== Date: Wed, 15 Apr 2020 13:32:06 +0000 Message-ID: <3f68f5162f10451ebe487e4047a56b82@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.102.217] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Spam-Status: No, score=-24.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2020 13:32:12 -0000 After commit 2911cb68ed3d6c515ad1979237e74e1fefab3674("aarch64: Optimized implementation of strnlen"), there is a problem when calling the strnlen interface to handle the string length of 9 or more This reverts commit 2911cb68ed3d6c515ad1979237e74e1fefab3674. --- sysdeps/aarch64/strnlen.S | 52 +---------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) -- 2.12.3 diff --git a/sysdeps/aarch64/strnlen.S b/sysdeps/aarch64/strnlen.S index 5981247dd9..2b55eda6db 100644 --- a/sysdeps/aarch64/strnlen.S +++ b/sysdeps/aarch64/strnlen.S @@ -45,11 +45,6 @@ #define pos x13 #define limit_wd x14 -#define dataq q2 -#define datav v2 -#define datab2 b3 -#define dataq2 q3 -#define datav2 v3 #define REP8_01 0x0101010101010101 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 @@ -76,7 +71,7 @@ ENTRY_ALIGN_AND_PAD (__strnlen, 6, 9) cycle, as we get much better parallelism out of the operations. */ /* Start of critial section -- keep to one 64Byte cache line. */ - +L(loop): ldp data1, data2, [src], #16 L(realigned): sub tmp1, data1, zeroones @@ -124,51 +119,6 @@ L(nul_in_data2): csel len, len, limit, ls /* Return the lower value. */ RET -L(loop): - ldr dataq, [src], #16 - uminv datab2, datav.16b - mov tmp1, datav2.d[0] - subs limit_wd, limit_wd, #1 - ccmp tmp1, #0, #4, pl /* NZCV = 0000 */ - b.eq L(loop_end) - ldr dataq, [src], #16 - uminv datab2, datav.16b - mov tmp1, datav2.d[0] - subs limit_wd, limit_wd, #1 - ccmp tmp1, #0, #4, pl /* NZCV = 0000 */ - b.ne L(loop) -L(loop_end): - /* End of critical section -- keep to one 64Byte cache line. */ - - cbnz tmp1, L(hit_limit) /* No null in final Qword. */ - - /* We know there's a null in the final Qword. The easiest thing - to do now is work out the length of the string and return - MIN (len, limit). */ - -#ifdef __AARCH64EB__ - rev64 datav.16b, datav.16b -#endif - /* Set te NULL byte as 0xff and the rest as 0x00, move the data into a - pair of scalars and then compute the length from the earliest NULL - byte. */ - - cmeq datav.16b, datav.16b, #0 - mov data1, datav.d[0] - mov data2, datav.d[1] - cmp data1, 0 - csel data1, data1, data2, ne - sub len, src, srcin - sub len, len, #16 - rev data1, data1 - add tmp2, len, 8 - clz tmp1, data1 - csel len, len, tmp2, ne - add len, len, tmp1, lsr 3 - cmp len, limit - csel len, len, limit, ls /* Return the lower value. */ - RET - L(misaligned): /* Deal with a partial first word. We're doing two things in parallel here;