This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug string/5806] wrong comment in strlen() and other functions
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 15 Jan 2018 10:55:42 +0000
- Subject: [Bug string/5806] wrong comment in strlen() and other functions
- Auto-submitted: auto-generated
- References: <bug-5806-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=5806
--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, azanella/generic-strings has been created
at 776bf884cdc6d8b7560311db143d954da2e969bf (commit)
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=776bf884cdc6d8b7560311db143d954da2e969bf
commit 776bf884cdc6d8b7560311db143d954da2e969bf
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Feb 21 17:14:16 2017 -0300
sh: Add string-fzb.h
Use the SH cmp/str on has_{zero,eq,zero_eq}.
Checked on sh4-linux-gnu.
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/sh/string-fzb.h: New file.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3f4eb93d500527cb988bca89b3ca1c55eaa7528b
commit 3f4eb93d500527cb988bca89b3ca1c55eaa7528b
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:26:18 2017 -0200
powerpc: Add string-fza.h
While ppc has the more important string functions in assembly,
there are still a few generic routines used.
Use the Power 6 CMPB insn for testing of zeros.
Checked on powerpc64le-linux-gnu.
Richard Henderson <rth@twiddle.net>
* sysdeps/powerpc/string-fza.h: New file.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=faf34eb8e865d099db877561b20d6bd82793ee5d
commit faf34eb8e865d099db877561b20d6bd82793ee5d
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:24:23 2017 -0200
arm: Add string-fza.h
While arm has the more important string functions in assembly,
there are still a few generic routines used.
Use the UQSUB8 insn for testing of zeros.
Checked on armv7-linux-gnueabihf
Richard Henderson <rth@twiddle.net>
* sysdeps/arm/armv6t2/string-fza.h: New file.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5115c06c369958195d7200f1fefadec6a7194c16
commit 5115c06c369958195d7200f1fefadec6a7194c16
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:23:27 2017 -0200
alpha: Add string-fzb.h and string-fzi.h
While alpha has the more important string functions in assembly,
there are still a few for find the generic routines are used.
Use the CMPBGE insn, via the builtin, for testing of zeros. Use a
simplified expansion of __builtin_ctz when the insn isn't available.
Checked on alpha-linux-gnu.
Richard Henderson <rth@twiddle.net>
* sysdeps/alpha/string-fzb.h: New file.
* sysdeps/alpha/string-fzi.h: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=eb974666a0cb7f1c834e23c598bd70ea5467d85b
commit eb974666a0cb7f1c834e23c598bd70ea5467d85b
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:22:39 2017 -0200
hppa: Add string-fzb.h and string-fzi.h
Use UXOR,SBZ to test for a zero byte within a word. While we can
get semi-decent code out of asm-goto, we would do slightly better
with a compiler builtin.
For index_zero et al, sequential testing of bytes is less expensive than
any tricks that involve a count-leading-zeros insn that we don't have.
Checked on hppa-linux-gnu.
Richard Henderson <rth@twiddle.net>
* sysdeps/hppa/string-fzb.h: New file.
* sysdeps/hppa/string-fzi.h: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=44c7540c69f6c01d19e34b8c6d06dc8eabef8ef9
commit 44c7540c69f6c01d19e34b8c6d06dc8eabef8ef9
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:22:02 2017 -0200
hppa: Add memcopy.h
GCC's combine pass cannot merge (x >> c | y << (32 - c)) into a
double-word shift unless (1) the subtract is in the same basic block
and (2) the result of the subtract is used exactly once. Neither
condition is true for any use of MERGE.
By forcing the use of a double-word shift, we not only reduce
contention on SAR, but also allow the setting of SAR to be hoisted
outside of a loop.
Checked on hppa-linux-gnu.
Richard Henderson <rth@twiddle.net>
* sysdeps/hppa/memcopy.h: New file.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fc8a77c5b25196847a405781ffe472ff9e8eb6ce
commit fc8a77c5b25196847a405781ffe472ff9e8eb6ce
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Wed Mar 8 16:56:17 2017 +0100
string: Improve generic strcpy
New generic implementation tries to use word operations along with
the new string-fz{b,i} functions even for inputs with different
alignments (with still uses aligned access plus merge operation
to get a correct word by word comparison).
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* string/strcpy.c: Rewrite using memcopy.h, string-fzb.h,
string-fzi.h.
* string/test-strcpy.c (test_main): Add more coverage.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0c653b42a1f2ef3b52be833b56596aefa8ad5736
commit 0c653b42a1f2ef3b52be833b56596aefa8ad5736
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:21:26 2017 -0200
string: Improve generic strcmp
New generic implementation tries to use word operations along with
the new string-fz{b,i} functions even for inputs with different
alignments (with still uses aligned access plus merge operation
to get a correct word by word comparison).
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* string/strcmp.c: Rewrite using memcopy.h, string-fzb.h,
string-fzi.h.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c79804d028a9ebd21de6ae1442ce706fa3c1d7c2
commit c79804d028a9ebd21de6ae1442ce706fa3c1d7c2
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:19:40 2017 -0200
string: Improve generic strchrnul
New algorithm have the following key differences:
- Reads first word unaligned and use string-maskoff function to
remove unwanted data. This strategy follow assemble optimized
ones for aarch64, powerpc and tile.
- Use string-fz{b,i} functions.
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
[BZ #5806]
* string/strchrnul.c: Use string-fzb.h, string-fzi.h.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1751ee1c285284a28725b820c18f8d2b7b5b9258
commit 1751ee1c285284a28725b820c18f8d2b7b5b9258
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:18:48 2017 -0200
string: Improve generic strchr
New algorithm have the following key differences:
- Reads first word unaligned and use string-maskoff function to
remove unwanted data. This strategy follow assemble optimized
ones for aarch64 and powerpc.
- Use string-fz{b,i} and string-extbyte function.
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #5806]
* string/strchr.c: Use string-fzb.h, string-fzi.h, string-extbyte.h.
* sysdeps/s390/multiarch/strchr-c.c: Redefine weak_alias.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6d2690c0cb8b6b73ff6eb1309d231467c688aafd
commit 6d2690c0cb8b6b73ff6eb1309d231467c688aafd
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 16 16:21:03 2017 -0200
string: Improve generic strnlen
With an optimized memchr, new strnlen implementation basically calls
memchr and adjust the result pointer value.
It also cleanups the multiple inclusion by leaving the ifunc
implementation to undef the weak_alias and libc_hidden_def.
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #5806]
* string/strnlen.c: Rewrite in terms of memchr.
* sysdeps/i386/i686/multiarch/strnlen-c.c: Redefine weak_alias
and libc_hidden_def.
* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c:
Likewise.
* sysdeps/s390/multiarch/strnlen-c.c: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6702dd345ea55ccb468684bd809835a6c719c198
commit 6702dd345ea55ccb468684bd809835a6c719c198
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:20:35 2017 -0200
string: Improve generic memrchr
New algorithm have the following key differences:
- Use string-fz{b,i} functions.
It also cleanups the multiple inclusion by leaving the ifunc
implementation to undef the weak_alias.
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #5806]
* string/memrchr.c: Use string-fzb.h, string-fzi.h.
* sysdeps/i386/i686/multiarch/memrchr-c.c: Redefined weak_alias.
* sysdeps/s390/multiarch/memrchr-c.c: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1c12833514864aba99b01b2f173e1a98ec1f9658
commit 1c12833514864aba99b01b2f173e1a98ec1f9658
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:19:12 2017 -0200
string: Improve generic memchr
New algorithm have the following key differences:
- Reads first word unaligned and use string-maskoff function to
remove unwanted data. This strategy follow assemble optimized
ones for aarch64, powerpc and tile.
- Use string-fz{b,i} and string-opthr functions.
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
[BZ #5806]
* string/memchr.c: Use string-fzb.h, string-fzi.h, string-opthr.h.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=96419fb9b7feee1c05dd99ba4afdc89d94ef4aad
commit 96419fb9b7feee1c05dd99ba4afdc89d94ef4aad
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:18:24 2017 -0200
string: Improve generic strlen
New algorithm have the following key differences:
- Reads first word unaligned and use string-maskoff functions to
remove unwanted data. This strategy follow assemble optimized
ones for powerpc, sparc, and SH.
- Use of has_zero and index_first_zero parametrized functions.
Checked on x86_64-linux-gnu, i686-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
[BZ #5806]
* string/strlen.c: Use them.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=438e5fcc0aff82752229bd88bbaffafc63ec6b81
commit 438e5fcc0aff82752229bd88bbaffafc63ec6b81
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon Jan 8 16:41:43 2018 -0200
Add string vectorized find and detection functions
This patch adds generic string find and detection implementation meant
to be used in generic vectorized string implementation. The idea is to
decompose the basic string operation so each architecture can reimplement
if it provides any specialized hardware instruction.
The 'string-fza.h' provides zero byte detection functions (find_zero_low,
find_zero_all, find_eq_low, find_eq_all, find_zero_eq_low,
find_zero_eq_all,
find_zero_ne_low, and find_zero_ne_all). They are used on both functions
provided by 'string-fzb.h' and 'string-fzi'.
The 'string-fzb.h' provides boolean zero byte detection with the
functions:
- has_zero: determine if any byte within a word is zero.
- has_eq: determine byte equality between two words.
- has_zero_eq: determine if any byte within a word is zero along with
byte equality between two words.
The 'string-fzi.h' provides zero byte detection along with its positions:
- index_first_zero: return index of first zero byte within a word.
- index_first_eq: return index of first byte different between two words.
- index_first_zero_eq: return index of first zero byte within a word or
first byte different between two words.
- index_first_zero_ne: return index of first zero byte within a word or
first byte equal between two words.
- index_last_zero: return index of last zero byte within a word.
- index_last_eq: return index of last byte different between two words.
Also, to avoid libcalls in the '__builtin_c{t,l}z{l}' calls (which may
add performance degradation), inline implementation based on De Bruijn
sequences are added (enabled by a configure check).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* config.h.in (HAVE_BUILTIN_CTZ, HAVE_BUILTIN_CLZ): New defines.
* configure.ac: Check for __builtin_ctz{l} with no external
dependencies
* sysdeps/generic/string-extbyte.h: New file.
* sysdeps/generic/string-fza.h: Likewise.
* sysdeps/generic/string-fzb.h: Likewise.
* sysdeps/generic/string-fzi.h: Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=447f15451d1761d9d1aad2b8440b19eb189e8811
commit 447f15451d1761d9d1aad2b8440b19eb189e8811
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Thu Feb 23 18:45:54 2017 -0300
Add string-maskoff.h generic header
Macros to operate on unaligned access for string operations:
- create_mask: create a mask based on pointer alignment to sets up
non-zero bytes before the beginning of the word so a following
operation (such as find zero) might ignore these bytes.
- highbit_mask: create a mask with high bit of each byte being 1,
and the low 7 bits being all the opposite of the input.
These macros are meant to be used on optimized vectorized string
implementations.
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/generic/string-maskoff.h: New file.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c43ccd7a9f279b15f3e7241ecc35e49ea6330a81
commit c43ccd7a9f279b15f3e7241ecc35e49ea6330a81
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:15:27 2017 -0200
Parameterize OP_T_THRES from memcopy.h
Basically it moves OP_T_THRES out of memcopy.h to its own header
and adjust each architecture that redefines it.
Checked with a build and check with run-built-tests=no for all major
Linux ABIs (alpha, aarch64, arm, hppa, i686, ia64, m68k, microblaze,
mips, mips64, nios2, powerpc, powerpc64le, s390x, sh4, sparc64,
tilegx, and x86_64).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/generic/memcopy.h (OP_T_THRES): Move...
* sysdeps/generic/string-opthr.h: ... here; new file.
* sysdeps/i386/memcopy.h (OP_T_THRES): Move...
* sysdeps/i386/string-opthr.h: ... here; new file.
* sysdeps/m68k/memcopy.h (OP_T_THRES): Remove.
* string/memcmp.c (OP_T_THRES): Remove definition.
* sysdeps/powerpc/powerpc32/power4/memcopy.h (OP_T_THRES): Likewise.
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1cca35adf040a1a22f48138569709ab71fd5bb32
commit 1cca35adf040a1a22f48138569709ab71fd5bb32
Author: Richard Henderson <rth@twiddle.net>
Date: Thu Feb 16 16:14:09 2017 -0200
Parameterize op_t from memcopy.h
Basically moves op_t definition out to an specific header, adds
the attribute 'may-alias', and cleanup its duplicated definitions.
It lead to inclusion of tilegx32 gmp-mparam.h similar to x32 so
op_t can be define as a long long (from _LONG_LONG_LIMB).
Checked with a build and check with run-built-tests=no for all major
Linux ABIs (alpha, aarch64, arm, hppa, i686, ia64, m68k, microblaze,
mips, mips64, nios2, powerpc, powerpc64le, s390x, sh4, sparc64,
tilegx, and x86_64).
Richard Henderson <rth@twiddle.net>
Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/generic/string-optype.h: New file.
* sysdeps/generic/memcopy.h: Include it.
* string/memcmp.c (op_t): Remove define.
* sysdeps/tile/memcmp.c (op_t): Likewise.
* sysdeps/tile/memcopy.h (op_t): Likewise.
* sysdeps/tile/tilegx32/gmp-mparam.h: New file.
-----------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.