This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug string/5806] wrong comment in strlen() and other functions


https://sourceware.org/bugzilla/show_bug.cgi?id=5806

--- Comment #8 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  52a9cf06655e8b65b51de679c7550c2c1c2d837b (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=52a9cf06655e8b65b51de679c7550c2c1c2d837b

commit 52a9cf06655e8b65b51de679c7550c2c1c2d837b
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=24d01f48967662e8f356d8367658cbb192617667

commit 24d01f48967662e8f356d8367658cbb192617667
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/power6/string-fza.h: New file.
        * sysdeps/powerpc/powerpc32/power6/string-fza.h: New file.
        * sysdeps/powerpc/powerpc64/power6/string-fza.h: New file.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6b67749f9df8400b8d0a768f78333302d7c5d9f6

commit 6b67749f9df8400b8d0a768f78333302d7c5d9f6
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=099a39660c4d50187f30a87a52dc92cfca22df34

commit 099a39660c4d50187f30a87a52dc92cfca22df34
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-fza.h: New file.
        * sysdeps/alpha/string-fzb.h: New file.
        * sysdeps/alpha/string-fzi.h: New file.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6d266c6fee641c4c9724086dcb9e07c02c5a5bf

commit b6d266c6fee641c4c9724086dcb9e07c02c5a5bf
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-fza.h: New file.
        * sysdeps/hppa/string-fzb.h: New file.
        * sysdeps/hppa/string-fzi.h: New file.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ebb0353dba2ed38ff88bcf8ea03eb80bb41b3e4f

commit ebb0353dba2ed38ff88bcf8ea03eb80bb41b3e4f
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=5c29485b5e15798ef3ede33272b36df521e4cbec

commit 5c29485b5e15798ef3ede33272b36df521e4cbec
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.

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=84bfd24e57385ce8e5d37e148443f22661e87490

commit 84bfd24e57385ce8e5d37e148443f22661e87490
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=572c3a397d79ab9efa89d131f72ef2d6b438eb69

commit 572c3a397d79ab9efa89d131f72ef2d6b438eb69
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=500a7f1a861e801292bfd70d9e6c4539550f0f56

commit 500a7f1a861e801292bfd70d9e6c4539550f0f56
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=2368dc1dcac592501eb07bc6c9d0fa6f9c43251b

commit 2368dc1dcac592501eb07bc6c9d0fa6f9c43251b
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=8b5ae84584e867a592a6134c5f9165600b8ae7c1

commit 8b5ae84584e867a592a6134c5f9165600b8ae7c1
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=15b7238287bebef55d6ef2191766990713d9b977

commit 15b7238287bebef55d6ef2191766990713d9b977
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=096c5ae2a75e1b8b641c97015f9deaee5a17b2cc

commit 096c5ae2a75e1b8b641c97015f9deaee5a17b2cc
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=c6766b5d52369eae2b64b4c0d23482afa76e0cd6

commit c6766b5d52369eae2b64b4c0d23482afa76e0cd6
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=040bb0502a08765e01ba31708719e657a8c113b1

commit 040bb0502a08765e01ba31708719e657a8c113b1
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=69030c746991d2d12d8b2c37ff84d350d6c412ee

commit 69030c746991d2d12d8b2c37ff84d350d6c412ee
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=aa7c9fa3a21562f9abdacac629b6fcef64551d6a

commit aa7c9fa3a21562f9abdacac629b6fcef64551d6a
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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]