string: Improve generic strlen
commit350d8d13661a863e6b189f02d876fa265fe71302
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 10 Jan 2023 21:00:54 +0000 (10 18:00 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 6 Feb 2023 19:19:35 +0000 (6 16:19 -0300)
treee0db50d920d3edecd1becd9b65c7be91810609d0
parent00cb84dde75f44847aab094aa3779cc5d222c7e4
string: Improve generic strlen

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

Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powercp64-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/strlen.c
sysdeps/s390/strlen-c.c