string: Improve generic strchrnul
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 10 Jan 2023 21:00:57 +0000 (18:00 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Feb 2023 19:19:35 +0000 (16:19 -0300)
commit685e844a97ba0506dee575ba530b170edaa59fed
tree99800df5d60b81d2de6e8d038a0ea8bc8fa9c80f
parent350d8d13661a863e6b189f02d876fa265fe71302
string: Improve generic strchrnul

New algorithm read the first aligned address and mask off the unwanted
bytes (this strategy is similar to arch-specific  implementations used
on powerpc, sparc, and sh).

The loop now read word-aligned address and check using the has_zero_eq
function.

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).

Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
string/strchrnul.c
sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c
sysdeps/s390/strchrnul-c.c