public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Add ifunc support for str{nlen, cmp, ncmp}
@ 2023-08-22  2:11 dengjianbo
  2023-08-22  2:11 ` [PATCH 1/3] Loongarch: Add ifunc support for strnlen{aligned, lsx, lasx} dengjianbo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: dengjianbo @ 2023-08-22  2:11 UTC (permalink / raw)
  To: libc-alpha
  Cc: adhemerval.zanella, xry111, caiyinyu, xuchenghua, huangpei, dengjianbo

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-23  7:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22  2:11 [PATCH 0/3] Add ifunc support for str{nlen, cmp, ncmp} dengjianbo
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

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).