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 libc/19765] s390 needs an optimized mempcpy


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

--- Comment #1 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, master has been updated
       via  4c011268960c6f24650672597deed756f21ad363 (commit)
       via  71655832555411915d157b17253c8ffe0848533a (commit)
       via  074b0f27d9b9cdfb58c5c7e7f4129546084582b2 (commit)
       via  04bb21ac93e90d7696bcaf8febe2b2dd2d83585a (commit)
      from  dea39b13e2958a7f0e75b5594a06d97d61cc439f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 4c011268960c6f24650672597deed756f21ad363
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue May 24 10:39:13 2016 +0200

    S390: Implement mempcpy with help of memcpy. [BZ #19765]

    There exist optimized memcpy functions on s390, but no optimized mempcpy.
    This patch adds mempcpy entry points in memcpy.S files, which
    use the memcpy implementation. Now mempcpy itself is also an IFUNC function
    as memcpy is and the variants are listed in ifunc-impl-list.c.

    The s390 string.h does not define _HAVE_STRING_ARCH_mempcpy.
    Instead mempcpy string/string.h inlines memcpy() + n.
    If n is constant and small enough, GCC emits instructions like mvi or mvc
    and avoids the function call to memcpy.
    If n is not constant, then memcpy is called and n is added afterwards.
    If _HAVE_STRING_ARCH_mempcpy would be defined, mempcpy would be called in
    every case.

    According to PR70140 "Inefficient expansion of __builtin_mempcpy"
    (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70140) GCC should handle a
    call to mempcpy in the same way as memcpy. Then either the mempcpy macro
    in string/string.h has to be removed or _HAVE_STRING_ARCH_mempcpy has to
    be defined for S390.

    ChangeLog:

        [BZ #19765]
        * sysdeps/s390/mempcpy.S: New File.
        * sysdeps/s390/multiarch/mempcpy.c: Likewise.
        * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add mempcpy.
        * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list):
        Add mempcpy variants.
        * sysdeps/s390/s390-32/memcpy.S: Add mempcpy entry point.
        (memcpy): Adjust to be usable from mempcpy entry point.
        (__memcpy_mvcle): Likewise.
        * sysdeps/s390/s390-64/memcpy.S: Likewise.
        * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add entry points
        ____mempcpy_z196, ____mempcpy_z10 and add __GI_ symbols for mempcpy.
        (__memcpy_z196): Adjust to be usable from mempcpy entry point.
        (__memcpy_z10): Likewise.
        * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise.

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

commit 71655832555411915d157b17253c8ffe0848533a
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue May 24 10:39:13 2016 +0200

    S390: Do not call memcpy, memcmp, memset within libc.so via ifunc-plt.

    On s390, the memcpy, memcmp, memset functions are IFUNC symbols,
    which are created with s390_libc_ifunc-macro.
    This macro creates a __GI_ symbol which is set to the
    ifunced symbol. Thus calls within libc.so to e.g. memcpy
    result in a call to *ABS*+0x954c0@plt stub and afterwards
    to the resolved memcpy-ifunc-variant.

    This patch sets the __GI_ symbol to the default-ifunc-variant
    to avoid the plt call. The __GI_ symbols are now created at the
    default variant of ifunced function.

    ChangeLog:

        * sysdeps/s390/multiarch/ifunc-resolve.h (s390_libc_ifunc):
        Remove __GI_ symbol.
        * sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Add __GI_memcmp symbol.
        * sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Likewise.
        * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add __GI_memcpy symbol.
        * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise.
        * sysdeps/s390/s390-32/multiarch/memset-s390.S: Add __GI_memset symbol.
        * sysdeps/s390/s390-64/multiarch/memset-s390x.S: Likewise.

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

commit 074b0f27d9b9cdfb58c5c7e7f4129546084582b2
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue May 24 10:39:13 2016 +0200

    S390: Use 64bit instruction to check for copies of > 1MB with mvcle.

    The __memcpy_default variant on s390 64bit calculates the number of
    256byte blocks in a 64bit register and checks, if they exceed 1MB
    to jump to mvcle. Otherwise a mvc-loop is used. The compare-instruction
    only checks a 32bit value.
    This patch uses a 64bit compare.

    ChangeLog:

        * sysdeps/s390/s390-64/memcpy.S (memcpy):
        Use cghi instead of chi to compare 64bit value.

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

commit 04bb21ac93e90d7696bcaf8febe2b2dd2d83585a
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue May 24 10:39:13 2016 +0200

    S390: Use mvcle for copies > 1MB on 32bit with default memcpy variant.

    If more than 255 bytes should be copied, the algorithm jumps away.
    Before this patch, it jumps to the mvc-loop (.L_G5_12).
    Now it jumps first to the "> 1MB" check, which jumps away to
    __memcpy_mvcle. Otherwise, the mvc-loop (.L_G5_12) copies the bytes.

    ChangeLog:

        * sysdeps/s390/s390-32/memcpy.S (memcpy):
        Jump to 1MB check before executing mvc-loop.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   39 +++++++++++++++
 posix/tst-execvpe2.c => sysdeps/s390/mempcpy.S     |    5 +-
 sysdeps/s390/multiarch/Makefile                    |    3 +-
 sysdeps/s390/multiarch/ifunc-impl-list.c           |    7 +++
 sysdeps/s390/multiarch/ifunc-resolve.h             |    4 +-
 .../multiarch/memcpy.c => multiarch/mempcpy.c}     |   10 ++--
 sysdeps/s390/s390-32/memcpy.S                      |   52 ++++++++++++--------
 sysdeps/s390/s390-32/multiarch/memcmp-s390.S       |    3 +
 sysdeps/s390/s390-32/multiarch/memcpy-s390.S       |   36 ++++++++++++-
 sysdeps/s390/s390-32/multiarch/memset-s390.S       |    3 +
 sysdeps/s390/s390-64/memcpy.S                      |   49 +++++++++++--------
 sysdeps/s390/s390-64/multiarch/memcmp-s390x.S      |    3 +
 sysdeps/s390/s390-64/multiarch/memcpy-s390x.S      |   34 ++++++++++++-
 sysdeps/s390/s390-64/multiarch/memset-s390x.S      |    3 +
 14 files changed, 192 insertions(+), 59 deletions(-)
 copy posix/tst-execvpe2.c => sysdeps/s390/mempcpy.S (87%)
 copy sysdeps/s390/{s390-32/multiarch/memcpy.c => multiarch/mempcpy.c} (81%)

-- 
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]