Message ID | 20230822021118.3489949-1-dengjianbo@loongson.cn (mailing list archive) |
---|---|
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> 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 192D93831392 for <patchwork@sourceware.org>; Tue, 22 Aug 2023 02:11:41 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id D00B53858CD1 for <libc-alpha@sourceware.org>; Tue, 22 Aug 2023 02:11:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D00B53858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.5]) by gateway (Coremail) with SMTP id _____8AxqOhIGeRkrcQaAA--.18766S3; Tue, 22 Aug 2023 10:11:21 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxzyNIGeRk1PNfAA--.61763S2; Tue, 22 Aug 2023 10:11:20 +0800 (CST) From: dengjianbo <dengjianbo@loongson.cn> To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, xry111@xry111.site, caiyinyu@loongson.cn, xuchenghua@loongson.cn, huangpei@loongson.cn, dengjianbo <dengjianbo@loongson.cn> Subject: [PATCH 0/3] Add ifunc support for str{nlen, cmp, ncmp} Date: Tue, 22 Aug 2023 10:11:15 +0800 Message-Id: <20230822021118.3489949-1-dengjianbo@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8AxzyNIGeRk1PNfAA--.61763S2 X-CM-SenderInfo: pghqwyxldqu0o6or00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xhVjvjDU0xZFpf9x07j1YL9UUUUU= X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, 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.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Add ifunc support for str{nlen, cmp, ncmp}
|
|
Message
Deng Jianbo
Aug. 22, 2023, 2:11 a.m. UTC
This patch add mutiple versions of strnlen, strcmp, strncmp implemented by Loongarch basic instructions, LSX instructions, LASX instructions. Even though this implementation experience performance degradation in few cases, overall, the performace gains are significant. See: https://github.com/jiadengx/glibc_test/blob/main/bench/strnlen_compare.out https://github.com/jiadengx/glibc_test/blob/main/bench/strcmp_compare.out https://github.com/jiadengx/glibc_test/blob/main/bench/strncmp_compare.out In the data, positive values in the parentheses indicate that our implementation took less time, indicating a performance improvement; negative values in the parentheses mean that our implementation took more time, indicating a decrease in performance. Following is the summarise of the performance comparing with the generic version in the glibc microbenchmark: name reduce time percent strnlen-aligned >10% strnlen-lsx 50%-78% strnlen-lasx 50%-88% strcmp-aligned 0%-10% for aligned comparision 10%-20% for unaligned comparision strcmp-lsx 0%-50% strncmp-aligned 0%-10% for aligned comparision 10%-25% for unaligned comparision strncmp-lsx 0%-50% dengjianbo (3): Loongarch: Add ifunc support for strnlen{aligned, lsx, lasx} Loongarch: Add ifunc support for strcmp{aligned, lsx} Loongarch: Add ifunc support for strncmp{aligned, lsx} sysdeps/loongarch/lp64/multiarch/Makefile | 7 + .../lp64/multiarch/ifunc-impl-list.c | 22 ++ .../loongarch/lp64/multiarch/ifunc-strcmp.h | 38 +++ .../loongarch/lp64/multiarch/ifunc-strncmp.h | 38 +++ .../loongarch/lp64/multiarch/ifunc-strnlen.h | 41 ++++ .../loongarch/lp64/multiarch/strcmp-aligned.S | 179 ++++++++++++++ sysdeps/loongarch/lp64/multiarch/strcmp-lsx.S | 162 +++++++++++++ sysdeps/loongarch/lp64/multiarch/strcmp.c | 35 +++ .../lp64/multiarch/strncmp-aligned.S | 218 ++++++++++++++++++ .../loongarch/lp64/multiarch/strncmp-lsx.S | 206 +++++++++++++++++ sysdeps/loongarch/lp64/multiarch/strncmp.c | 35 +++ .../lp64/multiarch/strnlen-aligned.S | 102 ++++++++ .../loongarch/lp64/multiarch/strnlen-lasx.S | 100 ++++++++ .../loongarch/lp64/multiarch/strnlen-lsx.S | 89 +++++++ sysdeps/loongarch/lp64/multiarch/strnlen.c | 39 ++++ 15 files changed, 1311 insertions(+) create mode 100644 sysdeps/loongarch/lp64/multiarch/ifunc-strcmp.h create mode 100644 sysdeps/loongarch/lp64/multiarch/ifunc-strncmp.h create mode 100644 sysdeps/loongarch/lp64/multiarch/ifunc-strnlen.h create mode 100644 sysdeps/loongarch/lp64/multiarch/strcmp-aligned.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strcmp-lsx.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strcmp.c create mode 100644 sysdeps/loongarch/lp64/multiarch/strncmp-aligned.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strncmp-lsx.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strncmp.c create mode 100644 sysdeps/loongarch/lp64/multiarch/strnlen-aligned.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strnlen-lasx.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strnlen-lsx.S create mode 100644 sysdeps/loongarch/lp64/multiarch/strnlen.c