public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <20230822021118.3489949-1-dengjianbo@loongson.cn> (raw)

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

-- 
2.40.0


             reply	other threads:[~2023-08-22  2:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  2:11 dengjianbo [this message]
2023-08-22  2:11 ` [PATCH 1/3] Loongarch: Add ifunc support for strnlen{aligned, lsx, lasx} dengjianbo
2023-08-22  2:11 ` [PATCH 2/3] Loongarch: Add ifunc support for strcmp{aligned, lsx} dengjianbo
2023-08-22  2:11 ` [PATCH 3/3] Loongarch: Add ifunc support for strncmp{aligned, lsx} dengjianbo
2023-08-22  3:56   ` Richard Henderson
2023-08-22  6:37     ` dengjianbo
2023-08-22 11:13       ` Xi Ruoyao
2023-08-22 11:23         ` Xi Ruoyao
2023-08-23  7:25           ` dengjianbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230822021118.3489949-1-dengjianbo@loongson.cn \
    --to=dengjianbo@loongson.cn \
    --cc=adhemerval.zanella@linaro.org \
    --cc=caiyinyu@loongson.cn \
    --cc=huangpei@loongson.cn \
    --cc=libc-alpha@sourceware.org \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).