|
|
d8307d |
commit 18eb862d454a41012ccdd5127715ef7cd2a711ec
|
|
|
d8307d |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
d8307d |
Date: Tue Dec 18 13:57:06 2018 +0100
|
|
|
d8307d |
|
|
|
d8307d |
S390: Refactor memcpy/mempcpy ifunc handling.
|
|
|
d8307d |
|
|
|
d8307d |
This patch moves all ifunc variants for memcpy/mempcpy
|
|
|
d8307d |
to sysdeps/s390/memcpy-z900.S. The configure-check/preprocessor logic
|
|
|
d8307d |
in sysdeps/s390/ifunc-memcpy.h decides if ifunc is needed at all
|
|
|
d8307d |
and which ifunc variants should be available.
|
|
|
d8307d |
E.g. if the compiler/assembler already supports z196 by default,
|
|
|
d8307d |
the older ifunc variants are not included.
|
|
|
d8307d |
If we only need the newest ifunc variant,
|
|
|
d8307d |
then we can skip ifunc at all.
|
|
|
d8307d |
|
|
|
d8307d |
Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
|
|
|
d8307d |
in order to handle only the available ifunc variants.
|
|
|
d8307d |
|
|
|
d8307d |
ChangeLog:
|
|
|
d8307d |
|
|
|
d8307d |
* sysdeps/s390/ifunc-memcpy.h: New File.
|
|
|
d8307d |
* sysdeps/s390/memcpy.S: Move to ...
|
|
|
d8307d |
* sysdeps/s390/memcpy-z900.S ... here.
|
|
|
d8307d |
Move implementations from memcpy-s390x.s to here.
|
|
|
d8307d |
* sysdeps/s390/multiarch/memcpy-s390x.S: Delete File.
|
|
|
d8307d |
* sysdeps/s390/multiarch/Makefile (sysdep_routines):
|
|
|
d8307d |
Remove memcpy/mempcpy variants.
|
|
|
d8307d |
* sysdeps/s390/Makefile (sysdep_routines):
|
|
|
d8307d |
Add memcpy/mempcpy variants.
|
|
|
d8307d |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
(__libc_ifunc_impl_list): Adjust ifunc variants for
|
|
|
d8307d |
memcpy and mempcpy.
|
|
|
d8307d |
* sysdeps/s390/multiarch/memcpy.c: Move ifunc resolver
|
|
|
d8307d |
to ...
|
|
|
d8307d |
* sysdeps/s390/memcpy.c: ... here.
|
|
|
d8307d |
Adjust ifunc variants for memcpy.
|
|
|
d8307d |
* sysdeps/s390/multiarch/mempcpy.c: Move to ...
|
|
|
d8307d |
* sysdeps/s390/mempcpy.c: ... here.
|
|
|
d8307d |
Adjust ifunc variants for mempcpy.
|
|
|
d8307d |
* sysdeps/s390/mempcpy.S: Delete file.
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
d8307d |
index c59cbdc25aad408a..838950a5ab958e31 100644
|
|
|
d8307d |
--- a/sysdeps/s390/Makefile
|
|
|
d8307d |
+++ b/sysdeps/s390/Makefile
|
|
|
d8307d |
@@ -32,5 +32,6 @@ endif
|
|
|
d8307d |
|
|
|
d8307d |
ifeq ($(subdir),string)
|
|
|
d8307d |
sysdep_routines += bzero memset memset-z900 \
|
|
|
d8307d |
- memcmp memcmp-z900
|
|
|
d8307d |
+ memcmp memcmp-z900 \
|
|
|
d8307d |
+ mempcpy memcpy memcpy-z900
|
|
|
d8307d |
endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/ifunc-memcpy.h b/sysdeps/s390/ifunc-memcpy.h
|
|
|
d8307d |
new file mode 100644
|
|
|
d8307d |
index 0000000000000000..51c71baa2c0b0452
|
|
|
d8307d |
--- /dev/null
|
|
|
d8307d |
+++ b/sysdeps/s390/ifunc-memcpy.h
|
|
|
d8307d |
@@ -0,0 +1,68 @@
|
|
|
d8307d |
+/* memcpy variant information on S/390 version.
|
|
|
d8307d |
+ Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
d8307d |
+ This file is part of the GNU C Library.
|
|
|
d8307d |
+
|
|
|
d8307d |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
d8307d |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
d8307d |
+ License as published by the Free Software Foundation; either
|
|
|
d8307d |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
d8307d |
+
|
|
|
d8307d |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
d8307d |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d8307d |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
d8307d |
+ Lesser General Public License for more details.
|
|
|
d8307d |
+
|
|
|
d8307d |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
d8307d |
+ License along with the GNU C Library; if not, see
|
|
|
d8307d |
+ <http://www.gnu.org/licenses/>. */
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if defined SHARED && defined USE_MULTIARCH && IS_IN (libc) \
|
|
|
d8307d |
+ && ! defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
d8307d |
+# define HAVE_MEMCPY_IFUNC 1
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define HAVE_MEMCPY_IFUNC 0
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
d8307d |
+# define MEMCPY_DEFAULT MEMCPY_Z196
|
|
|
d8307d |
+# define MEMPCPY_DEFAULT MEMPCPY_Z196
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z900_G5 0
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z10 0
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z196 1
|
|
|
d8307d |
+#elif defined HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT
|
|
|
d8307d |
+# define MEMCPY_DEFAULT MEMCPY_Z10
|
|
|
d8307d |
+# define MEMPCPY_DEFAULT MEMPCPY_Z10
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z900_G5 0
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z10 1
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z196 HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define MEMCPY_DEFAULT MEMCPY_Z900_G5
|
|
|
d8307d |
+# define MEMPCPY_DEFAULT MEMPCPY_Z900_G5
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z900_G5 1
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z10 HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
+# define HAVE_MEMCPY_Z196 HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+# define MEMCPY_Z900_G5 __memcpy_default
|
|
|
d8307d |
+# define MEMPCPY_Z900_G5 __mempcpy_default
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define MEMCPY_Z900_G5 NULL
|
|
|
d8307d |
+# define MEMPCPY_Z900_G5 NULL
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z10
|
|
|
d8307d |
+# define MEMCPY_Z10 __memcpy_z10
|
|
|
d8307d |
+# define MEMPCPY_Z10 __mempcpy_z10
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define MEMCPY_Z10 NULL
|
|
|
d8307d |
+# define MEMPCPY_Z10 NULL
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z196
|
|
|
d8307d |
+# define MEMCPY_Z196 __memcpy_z196
|
|
|
d8307d |
+# define MEMPCPY_Z196 __mempcpy_z196
|
|
|
d8307d |
+#else
|
|
|
d8307d |
+# define MEMCPY_Z196 NULL
|
|
|
d8307d |
+# define MEMPCPY_Z196 NULL
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/memcpy.S b/sysdeps/s390/memcpy-z900.S
|
|
|
d8307d |
similarity index 50%
|
|
|
d8307d |
rename from sysdeps/s390/memcpy.S
|
|
|
d8307d |
rename to sysdeps/s390/memcpy-z900.S
|
|
|
d8307d |
index 2a6c6b750377c7bb..3a50cf44d85d2417 100644
|
|
|
d8307d |
--- a/sysdeps/s390/memcpy.S
|
|
|
d8307d |
+++ b/sysdeps/s390/memcpy-z900.S
|
|
|
d8307d |
@@ -19,6 +19,7 @@
|
|
|
d8307d |
|
|
|
d8307d |
#include <sysdep.h>
|
|
|
d8307d |
#include "asm-syntax.h"
|
|
|
d8307d |
+#include <ifunc-memcpy.h>
|
|
|
d8307d |
|
|
|
d8307d |
/* INPUT PARAMETERS
|
|
|
d8307d |
%r2 = address of destination memory area
|
|
|
d8307d |
@@ -41,50 +42,46 @@
|
|
|
d8307d |
# define BRCTG brct
|
|
|
d8307d |
#endif /* ! defined __s390x__ */
|
|
|
d8307d |
|
|
|
d8307d |
-ENTRY(__mempcpy)
|
|
|
d8307d |
-#if defined __s390x__
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+ENTRY(MEMPCPY_Z900_G5)
|
|
|
d8307d |
+# if defined __s390x__
|
|
|
d8307d |
.machine "z900"
|
|
|
d8307d |
-#else
|
|
|
d8307d |
+# else
|
|
|
d8307d |
.machine "g5"
|
|
|
d8307d |
-#endif /* ! defined __s390x__ */
|
|
|
d8307d |
+# endif /* ! defined __s390x__ */
|
|
|
d8307d |
LGR %r1,%r2 # Use as dest
|
|
|
d8307d |
la %r2,0(%r4,%r2) # Return dest + n
|
|
|
d8307d |
j .L_Z900_G5_start
|
|
|
d8307d |
-END(__mempcpy)
|
|
|
d8307d |
-#ifndef USE_MULTIARCH
|
|
|
d8307d |
-libc_hidden_def (__mempcpy)
|
|
|
d8307d |
-weak_alias (__mempcpy, mempcpy)
|
|
|
d8307d |
-libc_hidden_builtin_def (mempcpy)
|
|
|
d8307d |
-#endif
|
|
|
d8307d |
+END(MEMPCPY_Z900_G5)
|
|
|
d8307d |
|
|
|
d8307d |
-ENTRY(memcpy)
|
|
|
d8307d |
-#if defined __s390x__
|
|
|
d8307d |
+ENTRY(MEMCPY_Z900_G5)
|
|
|
d8307d |
+# if defined __s390x__
|
|
|
d8307d |
.machine "z900"
|
|
|
d8307d |
-#else
|
|
|
d8307d |
+# else
|
|
|
d8307d |
.machine "g5"
|
|
|
d8307d |
-#endif /* ! defined __s390x__ */
|
|
|
d8307d |
+# endif /* ! defined __s390x__ */
|
|
|
d8307d |
LGR %r1,%r2 # r1: Use as dest ; r2: Return dest
|
|
|
d8307d |
.L_Z900_G5_start:
|
|
|
d8307d |
LTGR %r4,%r4
|
|
|
d8307d |
je .L_Z900_G5_4
|
|
|
d8307d |
AGHI %r4,-1
|
|
|
d8307d |
-#if defined __s390x__
|
|
|
d8307d |
+# if defined __s390x__
|
|
|
d8307d |
srlg %r5,%r4,8
|
|
|
d8307d |
-#else
|
|
|
d8307d |
+# else
|
|
|
d8307d |
lr %r5,%r4
|
|
|
d8307d |
srl %r5,8
|
|
|
d8307d |
-#endif /* ! defined __s390x__ */
|
|
|
d8307d |
+# endif /* ! defined __s390x__ */
|
|
|
d8307d |
LTGR %r5,%r5
|
|
|
d8307d |
jne .L_Z900_G5_13
|
|
|
d8307d |
.L_Z900_G5_3:
|
|
|
d8307d |
-#if defined __s390x__
|
|
|
d8307d |
+# if defined __s390x__
|
|
|
d8307d |
larl %r5,.L_Z900_G5_15
|
|
|
d8307d |
-# define Z900_G5_EX_D 0
|
|
|
d8307d |
-#else
|
|
|
d8307d |
+# define Z900_G5_EX_D 0
|
|
|
d8307d |
+# else
|
|
|
d8307d |
basr %r5,0
|
|
|
d8307d |
.L_Z900_G5_14:
|
|
|
d8307d |
-# define Z900_G5_EX_D .L_Z900_G5_15-.L_Z900_G5_14
|
|
|
d8307d |
-#endif /* ! defined __s390x__ */
|
|
|
d8307d |
+# define Z900_G5_EX_D .L_Z900_G5_15-.L_Z900_G5_14
|
|
|
d8307d |
+# endif /* ! defined __s390x__ */
|
|
|
d8307d |
ex %r4,Z900_G5_EX_D(%r5)
|
|
|
d8307d |
.L_Z900_G5_4:
|
|
|
d8307d |
br %r14
|
|
|
d8307d |
@@ -99,10 +96,8 @@ ENTRY(memcpy)
|
|
|
d8307d |
j .L_Z900_G5_3
|
|
|
d8307d |
.L_Z900_G5_15:
|
|
|
d8307d |
mvc 0(1,%r1),0(%r3)
|
|
|
d8307d |
-END(memcpy)
|
|
|
d8307d |
-#ifndef USE_MULTIARCH
|
|
|
d8307d |
-libc_hidden_builtin_def (memcpy)
|
|
|
d8307d |
-#endif
|
|
|
d8307d |
+END(MEMCPY_Z900_G5)
|
|
|
d8307d |
+#endif /* HAVE_MEMCPY_Z900_G5 */
|
|
|
d8307d |
|
|
|
d8307d |
ENTRY(__memcpy_mvcle)
|
|
|
d8307d |
# Using as standalone function will result in unexpected
|
|
|
d8307d |
@@ -126,3 +121,104 @@ END(__memcpy_mvcle)
|
|
|
d8307d |
#undef LGR
|
|
|
d8307d |
#undef AGHI
|
|
|
d8307d |
#undef BRCTG
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z10
|
|
|
d8307d |
+ENTRY(MEMPCPY_Z10)
|
|
|
d8307d |
+ .machine "z10"
|
|
|
d8307d |
+ .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
+ lgr %r1,%r2 # Use as dest
|
|
|
d8307d |
+ la %r2,0(%r4,%r2) # Return dest + n
|
|
|
d8307d |
+ j .L_Z10_start
|
|
|
d8307d |
+END(MEMPCPY_Z10)
|
|
|
d8307d |
+
|
|
|
d8307d |
+ENTRY(MEMCPY_Z10)
|
|
|
d8307d |
+ .machine "z10"
|
|
|
d8307d |
+ .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
+ lgr %r1,%r2 # r1: Use as dest ; r2: Return dest
|
|
|
d8307d |
+.L_Z10_start:
|
|
|
d8307d |
+# if !defined __s390x__
|
|
|
d8307d |
+ llgfr %r4,%r4
|
|
|
d8307d |
+# endif /* !defined __s390x__ */
|
|
|
d8307d |
+ cgije %r4,0,.L_Z10_4
|
|
|
d8307d |
+ aghi %r4,-1
|
|
|
d8307d |
+ srlg %r5,%r4,8
|
|
|
d8307d |
+ cgijlh %r5,0,.L_Z10_13
|
|
|
d8307d |
+.L_Z10_3:
|
|
|
d8307d |
+ exrl %r4,.L_Z10_15
|
|
|
d8307d |
+.L_Z10_4:
|
|
|
d8307d |
+ br %r14
|
|
|
d8307d |
+.L_Z10_13:
|
|
|
d8307d |
+ cgfi %r5,65535 # Switch to mvcle for copies >16MB
|
|
|
d8307d |
+ jh __memcpy_mvcle
|
|
|
d8307d |
+.L_Z10_12:
|
|
|
d8307d |
+ pfd 1,768(%r3)
|
|
|
d8307d |
+ pfd 2,768(%r1)
|
|
|
d8307d |
+ mvc 0(256,%r1),0(%r3)
|
|
|
d8307d |
+ la %r1,256(%r1)
|
|
|
d8307d |
+ la %r3,256(%r3)
|
|
|
d8307d |
+ brctg %r5,.L_Z10_12
|
|
|
d8307d |
+ j .L_Z10_3
|
|
|
d8307d |
+.L_Z10_15:
|
|
|
d8307d |
+ mvc 0(1,%r1),0(%r3)
|
|
|
d8307d |
+END(MEMCPY_Z10)
|
|
|
d8307d |
+#endif /* HAVE_MEMCPY_Z10 */
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_Z196
|
|
|
d8307d |
+ENTRY(MEMPCPY_Z196)
|
|
|
d8307d |
+ .machine "z196"
|
|
|
d8307d |
+ .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
+ lgr %r1,%r2 # Use as dest
|
|
|
d8307d |
+ la %r2,0(%r4,%r2) # Return dest + n
|
|
|
d8307d |
+ j .L_Z196_start
|
|
|
d8307d |
+END(MEMPCPY_Z196)
|
|
|
d8307d |
+
|
|
|
d8307d |
+ENTRY(MEMCPY_Z196)
|
|
|
d8307d |
+ .machine "z196"
|
|
|
d8307d |
+ .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
+ lgr %r1,%r2 # r1: Use as dest ; r2: Return dest
|
|
|
d8307d |
+.L_Z196_start:
|
|
|
d8307d |
+# if !defined __s390x__
|
|
|
d8307d |
+ llgfr %r4,%r4
|
|
|
d8307d |
+# endif /* !defined __s390x__ */
|
|
|
d8307d |
+ ltgr %r4,%r4
|
|
|
d8307d |
+ je .L_Z196_4
|
|
|
d8307d |
+ aghi %r4,-1
|
|
|
d8307d |
+ srlg %r5,%r4,8
|
|
|
d8307d |
+ ltgr %r5,%r5
|
|
|
d8307d |
+ jne .L_Z196_5
|
|
|
d8307d |
+.L_Z196_3:
|
|
|
d8307d |
+ exrl %r4,.L_Z196_14
|
|
|
d8307d |
+.L_Z196_4:
|
|
|
d8307d |
+ br %r14
|
|
|
d8307d |
+.L_Z196_5:
|
|
|
d8307d |
+ cgfi %r5,262144 # Switch to mvcle for copies >64MB
|
|
|
d8307d |
+ jh __memcpy_mvcle
|
|
|
d8307d |
+.L_Z196_2:
|
|
|
d8307d |
+ pfd 1,768(%r3)
|
|
|
d8307d |
+ pfd 2,768(%r1)
|
|
|
d8307d |
+ mvc 0(256,%r1),0(%r3)
|
|
|
d8307d |
+ aghi %r5,-1
|
|
|
d8307d |
+ la %r1,256(%r1)
|
|
|
d8307d |
+ la %r3,256(%r3)
|
|
|
d8307d |
+ jne .L_Z196_2
|
|
|
d8307d |
+ j .L_Z196_3
|
|
|
d8307d |
+.L_Z196_14:
|
|
|
d8307d |
+ mvc 0(1,%r1),0(%r3)
|
|
|
d8307d |
+END(MEMCPY_Z196)
|
|
|
d8307d |
+#endif /* HAVE_MEMCPY_Z196 */
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if ! HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
+/* If we don't use ifunc, define an alias for mem[p]cpy here.
|
|
|
d8307d |
+ Otherwise see sysdeps/s390/mem[p]cpy.c. */
|
|
|
d8307d |
+strong_alias (MEMCPY_DEFAULT, memcpy)
|
|
|
d8307d |
+strong_alias (MEMPCPY_DEFAULT, __mempcpy)
|
|
|
d8307d |
+weak_alias (__mempcpy, mempcpy)
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
+/* Defines the internal symbols.
|
|
|
d8307d |
+ Compare to libc_hidden_[builtin_]def (mem[p]cpy) in string/mem[p]cpy.c. */
|
|
|
d8307d |
+strong_alias (MEMCPY_DEFAULT, __GI_memcpy)
|
|
|
d8307d |
+strong_alias (MEMPCPY_DEFAULT, __GI_mempcpy)
|
|
|
d8307d |
+strong_alias (MEMPCPY_DEFAULT, __GI___mempcpy)
|
|
|
d8307d |
+#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/memcpy.c b/sysdeps/s390/memcpy.c
|
|
|
d8307d |
similarity index 60%
|
|
|
d8307d |
rename from sysdeps/s390/multiarch/memcpy.c
|
|
|
d8307d |
rename to sysdeps/s390/memcpy.c
|
|
|
d8307d |
index c9577a854a0c7e68..90a53ac27d4be755 100644
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/memcpy.c
|
|
|
d8307d |
+++ b/sysdeps/s390/memcpy.c
|
|
|
d8307d |
@@ -16,12 +16,34 @@
|
|
|
d8307d |
License along with the GNU C Library; if not, see
|
|
|
d8307d |
<http://www.gnu.org/licenses/>. */
|
|
|
d8307d |
|
|
|
d8307d |
-/* In the static lib memcpy is needed before the reloc is resolved. */
|
|
|
d8307d |
-#if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
+#include <ifunc-memcpy.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+#if HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
# define memcpy __redirect_memcpy
|
|
|
d8307d |
# include <string.h>
|
|
|
d8307d |
# undef memcpy
|
|
|
d8307d |
# include <ifunc-resolve.h>
|
|
|
d8307d |
|
|
|
d8307d |
-s390_libc_ifunc (__redirect_memcpy, __memcpy, memcpy)
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+extern __typeof (__redirect_memcpy) MEMCPY_Z900_G5 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z10
|
|
|
d8307d |
+extern __typeof (__redirect_memcpy) MEMCPY_Z10 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z196
|
|
|
d8307d |
+extern __typeof (__redirect_memcpy) MEMCPY_Z196 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+s390_libc_ifunc_expr (__redirect_memcpy, memcpy,
|
|
|
d8307d |
+ ({
|
|
|
d8307d |
+ s390_libc_ifunc_init ();
|
|
|
d8307d |
+ (HAVE_MEMCPY_Z196 && S390_IS_Z196 (stfle_bits))
|
|
|
d8307d |
+ ? MEMCPY_Z196
|
|
|
d8307d |
+ : (HAVE_MEMCPY_Z10 && S390_IS_Z10 (stfle_bits))
|
|
|
d8307d |
+ ? MEMCPY_Z10
|
|
|
d8307d |
+ : MEMCPY_DEFAULT;
|
|
|
d8307d |
+ })
|
|
|
d8307d |
+ )
|
|
|
d8307d |
#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/mempcpy.S b/sysdeps/s390/mempcpy.S
|
|
|
d8307d |
deleted file mode 100644
|
|
|
d8307d |
index 18ef29213e26e76d..0000000000000000
|
|
|
d8307d |
--- a/sysdeps/s390/mempcpy.S
|
|
|
d8307d |
+++ /dev/null
|
|
|
d8307d |
@@ -1,19 +0,0 @@
|
|
|
d8307d |
-/* CPU specific mempcpy without multiarch - 32/64 bit S/390 version.
|
|
|
d8307d |
- Copyright (C) 2016-2018 Free Software Foundation, Inc.
|
|
|
d8307d |
- This file is part of the GNU C Library.
|
|
|
d8307d |
-
|
|
|
d8307d |
- The GNU C Library is free software; you can redistribute it and/or
|
|
|
d8307d |
- modify it under the terms of the GNU Lesser General Public
|
|
|
d8307d |
- License as published by the Free Software Foundation; either
|
|
|
d8307d |
- version 2.1 of the License, or (at your option) any later version.
|
|
|
d8307d |
-
|
|
|
d8307d |
- The GNU C Library is distributed in the hope that it will be useful,
|
|
|
d8307d |
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d8307d |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
d8307d |
- Lesser General Public License for more details.
|
|
|
d8307d |
-
|
|
|
d8307d |
- You should have received a copy of the GNU Lesser General Public
|
|
|
d8307d |
- License along with the GNU C Library; if not, see
|
|
|
d8307d |
- <http://www.gnu.org/licenses/>. */
|
|
|
d8307d |
-
|
|
|
d8307d |
-/* mempcpy is implemented in memcpy.S. */
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/mempcpy.c b/sysdeps/s390/mempcpy.c
|
|
|
d8307d |
similarity index 63%
|
|
|
d8307d |
rename from sysdeps/s390/multiarch/mempcpy.c
|
|
|
d8307d |
rename to sysdeps/s390/mempcpy.c
|
|
|
d8307d |
index 363fe47aefb80978..a6a237312659c2c1 100644
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/mempcpy.c
|
|
|
d8307d |
+++ b/sysdeps/s390/mempcpy.c
|
|
|
d8307d |
@@ -16,8 +16,9 @@
|
|
|
d8307d |
License along with the GNU C Library; if not, see
|
|
|
d8307d |
<http://www.gnu.org/licenses/>. */
|
|
|
d8307d |
|
|
|
d8307d |
+#include <ifunc-memcpy.h>
|
|
|
d8307d |
|
|
|
d8307d |
-#if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
+#if HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
# define mempcpy __redirect_mempcpy
|
|
|
d8307d |
# define __mempcpy __redirect___mempcpy
|
|
|
d8307d |
# define __NO_STRING_INLINES
|
|
|
d8307d |
@@ -27,6 +28,27 @@
|
|
|
d8307d |
# undef __mempcpy
|
|
|
d8307d |
# include <ifunc-resolve.h>
|
|
|
d8307d |
|
|
|
d8307d |
-s390_libc_ifunc (__redirect___mempcpy, ____mempcpy, __mempcpy)
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+extern __typeof (__redirect___mempcpy) MEMPCPY_Z900_G5 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z10
|
|
|
d8307d |
+extern __typeof (__redirect___mempcpy) MEMPCPY_Z10 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z196
|
|
|
d8307d |
+extern __typeof (__redirect___mempcpy) MEMPCPY_Z196 attribute_hidden;
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+
|
|
|
d8307d |
+s390_libc_ifunc_expr (__redirect___mempcpy, __mempcpy,
|
|
|
d8307d |
+ ({
|
|
|
d8307d |
+ s390_libc_ifunc_init ();
|
|
|
d8307d |
+ (HAVE_MEMCPY_Z196 && S390_IS_Z196 (stfle_bits))
|
|
|
d8307d |
+ ? MEMPCPY_Z196
|
|
|
d8307d |
+ : (HAVE_MEMCPY_Z10 && S390_IS_Z10 (stfle_bits))
|
|
|
d8307d |
+ ? MEMPCPY_Z10
|
|
|
d8307d |
+ : MEMPCPY_DEFAULT;
|
|
|
d8307d |
+ })
|
|
|
d8307d |
+ )
|
|
|
d8307d |
weak_alias (__mempcpy, mempcpy);
|
|
|
d8307d |
#endif
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/Makefile b/sysdeps/s390/multiarch/Makefile
|
|
|
d8307d |
index 3cbd5fad69e355a5..24949cd3a88b8015 100644
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/Makefile
|
|
|
d8307d |
+++ b/sysdeps/s390/multiarch/Makefile
|
|
|
d8307d |
@@ -18,8 +18,7 @@ sysdep_routines += strlen strlen-vx strlen-c \
|
|
|
d8307d |
memchr memchr-vx \
|
|
|
d8307d |
rawmemchr rawmemchr-vx rawmemchr-c \
|
|
|
d8307d |
memccpy memccpy-vx memccpy-c \
|
|
|
d8307d |
- memrchr memrchr-vx memrchr-c \
|
|
|
d8307d |
- mempcpy memcpy memcpy-s390x
|
|
|
d8307d |
+ memrchr memrchr-vx memrchr-c
|
|
|
d8307d |
endif
|
|
|
d8307d |
|
|
|
d8307d |
ifeq ($(subdir),wcsmbs)
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
index 2e57d01abc21522e..6969c480cc40e0e2 100644
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
d8307d |
@@ -23,6 +23,7 @@
|
|
|
d8307d |
#include <ifunc-resolve.h>
|
|
|
d8307d |
#include <ifunc-memset.h>
|
|
|
d8307d |
#include <ifunc-memcmp.h>
|
|
|
d8307d |
+#include <ifunc-memcpy.h>
|
|
|
d8307d |
|
|
|
d8307d |
/* Maximum number of IFUNC implementations. */
|
|
|
d8307d |
#define MAX_IFUNC 3
|
|
|
d8307d |
@@ -95,23 +96,35 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
d8307d |
)
|
|
|
d8307d |
#endif /* HAVE_MEMCMP_IFUNC */
|
|
|
d8307d |
|
|
|
d8307d |
-#ifdef SHARED
|
|
|
d8307d |
-
|
|
|
d8307d |
+#if HAVE_MEMCPY_IFUNC
|
|
|
d8307d |
IFUNC_IMPL (i, name, memcpy,
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z196
|
|
|
d8307d |
IFUNC_IMPL_ADD (array, i, memcpy,
|
|
|
d8307d |
- S390_IS_Z196 (stfle_bits), __memcpy_z196)
|
|
|
d8307d |
+ S390_IS_Z196 (stfle_bits), MEMCPY_Z196)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z10
|
|
|
d8307d |
IFUNC_IMPL_ADD (array, i, memcpy,
|
|
|
d8307d |
- S390_IS_Z10 (stfle_bits), __memcpy_z10)
|
|
|
d8307d |
- IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_default))
|
|
|
d8307d |
+ S390_IS_Z10 (stfle_bits), MEMCPY_Z10)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+ IFUNC_IMPL_ADD (array, i, memcpy, 1, MEMCPY_Z900_G5)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+ )
|
|
|
d8307d |
|
|
|
d8307d |
IFUNC_IMPL (i, name, mempcpy,
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z196
|
|
|
d8307d |
IFUNC_IMPL_ADD (array, i, mempcpy,
|
|
|
d8307d |
- S390_IS_Z196 (stfle_bits), ____mempcpy_z196)
|
|
|
d8307d |
+ S390_IS_Z196 (stfle_bits), MEMPCPY_Z196)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z10
|
|
|
d8307d |
IFUNC_IMPL_ADD (array, i, mempcpy,
|
|
|
d8307d |
- S390_IS_Z10 (stfle_bits), ____mempcpy_z10)
|
|
|
d8307d |
- IFUNC_IMPL_ADD (array, i, mempcpy, 1, ____mempcpy_default))
|
|
|
d8307d |
-
|
|
|
d8307d |
-#endif /* SHARED */
|
|
|
d8307d |
+ S390_IS_Z10 (stfle_bits), MEMPCPY_Z10)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+# if HAVE_MEMCPY_Z900_G5
|
|
|
d8307d |
+ IFUNC_IMPL_ADD (array, i, mempcpy, 1, MEMPCPY_Z900_G5)
|
|
|
d8307d |
+# endif
|
|
|
d8307d |
+ )
|
|
|
d8307d |
+#endif /* HAVE_MEMCPY_IFUNC */
|
|
|
d8307d |
|
|
|
d8307d |
#ifdef HAVE_S390_VX_ASM_SUPPORT
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/sysdeps/s390/multiarch/memcpy-s390x.S b/sysdeps/s390/multiarch/memcpy-s390x.S
|
|
|
d8307d |
deleted file mode 100644
|
|
|
d8307d |
index b38caac72b8742e6..0000000000000000
|
|
|
d8307d |
--- a/sysdeps/s390/multiarch/memcpy-s390x.S
|
|
|
d8307d |
+++ /dev/null
|
|
|
d8307d |
@@ -1,132 +0,0 @@
|
|
|
d8307d |
-/* CPU specific memcpy implementations. 31/64 bit S/390 version.
|
|
|
d8307d |
- Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
|
|
d8307d |
- This file is part of the GNU C Library.
|
|
|
d8307d |
-
|
|
|
d8307d |
- The GNU C Library is free software; you can redistribute it and/or
|
|
|
d8307d |
- modify it under the terms of the GNU Lesser General Public
|
|
|
d8307d |
- License as published by the Free Software Foundation; either
|
|
|
d8307d |
- version 2.1 of the License, or (at your option) any later version.
|
|
|
d8307d |
-
|
|
|
d8307d |
- The GNU C Library is distributed in the hope that it will be useful,
|
|
|
d8307d |
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
d8307d |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
d8307d |
- Lesser General Public License for more details.
|
|
|
d8307d |
-
|
|
|
d8307d |
- You should have received a copy of the GNU Lesser General Public
|
|
|
d8307d |
- License along with the GNU C Library; if not, see
|
|
|
d8307d |
- <http://www.gnu.org/licenses/>. */
|
|
|
d8307d |
-
|
|
|
d8307d |
-
|
|
|
d8307d |
-#include "sysdep.h"
|
|
|
d8307d |
-#include "asm-syntax.h"
|
|
|
d8307d |
-
|
|
|
d8307d |
-/* INPUT PARAMETERS
|
|
|
d8307d |
- %r2 = target operands address
|
|
|
d8307d |
- %r3 = source operands address
|
|
|
d8307d |
- %r4 = number of bytes to copy. */
|
|
|
d8307d |
-
|
|
|
d8307d |
- .text
|
|
|
d8307d |
-
|
|
|
d8307d |
-#if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
-
|
|
|
d8307d |
-ENTRY(____mempcpy_z196)
|
|
|
d8307d |
- .machine "z196"
|
|
|
d8307d |
- .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
- lgr %r1,%r2 # Use as dest
|
|
|
d8307d |
- la %r2,0(%r4,%r2) # Return dest + n
|
|
|
d8307d |
- j .L_Z196_start
|
|
|
d8307d |
-END(____mempcpy_z196)
|
|
|
d8307d |
-
|
|
|
d8307d |
-ENTRY(__memcpy_z196)
|
|
|
d8307d |
- .machine "z196"
|
|
|
d8307d |
- .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
- lgr %r1,%r2 # r1: Use as dest ; r2: Return dest
|
|
|
d8307d |
-.L_Z196_start:
|
|
|
d8307d |
-# if !defined __s390x__
|
|
|
d8307d |
- llgfr %r4,%r4
|
|
|
d8307d |
-# endif /* !defined __s390x__ */
|
|
|
d8307d |
- ltgr %r4,%r4
|
|
|
d8307d |
- je .L_Z196_4
|
|
|
d8307d |
- aghi %r4,-1
|
|
|
d8307d |
- srlg %r5,%r4,8
|
|
|
d8307d |
- ltgr %r5,%r5
|
|
|
d8307d |
- jne .L_Z196_5
|
|
|
d8307d |
-.L_Z196_3:
|
|
|
d8307d |
- exrl %r4,.L_Z196_14
|
|
|
d8307d |
-.L_Z196_4:
|
|
|
d8307d |
- br %r14
|
|
|
d8307d |
-.L_Z196_5:
|
|
|
d8307d |
- cgfi %r5,262144 # Switch to mvcle for copies >64MB
|
|
|
d8307d |
- jh __memcpy_mvcle
|
|
|
d8307d |
-.L_Z196_2:
|
|
|
d8307d |
- pfd 1,768(%r3)
|
|
|
d8307d |
- pfd 2,768(%r1)
|
|
|
d8307d |
- mvc 0(256,%r1),0(%r3)
|
|
|
d8307d |
- aghi %r5,-1
|
|
|
d8307d |
- la %r1,256(%r1)
|
|
|
d8307d |
- la %r3,256(%r3)
|
|
|
d8307d |
- jne .L_Z196_2
|
|
|
d8307d |
- j .L_Z196_3
|
|
|
d8307d |
-.L_Z196_14:
|
|
|
d8307d |
- mvc 0(1,%r1),0(%r3)
|
|
|
d8307d |
-END(__memcpy_z196)
|
|
|
d8307d |
-
|
|
|
d8307d |
-ENTRY(____mempcpy_z10)
|
|
|
d8307d |
- .machine "z10"
|
|
|
d8307d |
- .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
- lgr %r1,%r2 # Use as dest
|
|
|
d8307d |
- la %r2,0(%r4,%r2) # Return dest + n
|
|
|
d8307d |
- j .L_Z10_start
|
|
|
d8307d |
-END(____mempcpy_z10)
|
|
|
d8307d |
-
|
|
|
d8307d |
-ENTRY(__memcpy_z10)
|
|
|
d8307d |
- .machine "z10"
|
|
|
d8307d |
- .machinemode "zarch_nohighgprs"
|
|
|
d8307d |
- lgr %r1,%r2 # r1: Use as dest ; r2: Return dest
|
|
|
d8307d |
-.L_Z10_start:
|
|
|
d8307d |
-# if !defined __s390x__
|
|
|
d8307d |
- llgfr %r4,%r4
|
|
|
d8307d |
-# endif /* !defined __s390x__ */
|
|
|
d8307d |
- cgije %r4,0,.L_Z10_4
|
|
|
d8307d |
- aghi %r4,-1
|
|
|
d8307d |
- srlg %r5,%r4,8
|
|
|
d8307d |
- cgijlh %r5,0,.L_Z10_13
|
|
|
d8307d |
-.L_Z10_3:
|
|
|
d8307d |
- exrl %r4,.L_Z10_15
|
|
|
d8307d |
-.L_Z10_4:
|
|
|
d8307d |
- br %r14
|
|
|
d8307d |
-.L_Z10_13:
|
|
|
d8307d |
- cgfi %r5,65535 # Switch to mvcle for copies >16MB
|
|
|
d8307d |
- jh __memcpy_mvcle
|
|
|
d8307d |
-.L_Z10_12:
|
|
|
d8307d |
- pfd 1,768(%r3)
|
|
|
d8307d |
- pfd 2,768(%r1)
|
|
|
d8307d |
- mvc 0(256,%r1),0(%r3)
|
|
|
d8307d |
- la %r1,256(%r1)
|
|
|
d8307d |
- la %r3,256(%r3)
|
|
|
d8307d |
- brctg %r5,.L_Z10_12
|
|
|
d8307d |
- j .L_Z10_3
|
|
|
d8307d |
-.L_Z10_15:
|
|
|
d8307d |
- mvc 0(1,%r1),0(%r3)
|
|
|
d8307d |
-END(__memcpy_z10)
|
|
|
d8307d |
-
|
|
|
d8307d |
-# define __mempcpy ____mempcpy_default
|
|
|
d8307d |
-#endif /* SHARED && IS_IN (libc) */
|
|
|
d8307d |
-
|
|
|
d8307d |
-#define memcpy __memcpy_default
|
|
|
d8307d |
-#include "../memcpy.S"
|
|
|
d8307d |
-#undef memcpy
|
|
|
d8307d |
-
|
|
|
d8307d |
-#if defined SHARED && IS_IN (libc)
|
|
|
d8307d |
-.globl __GI_memcpy
|
|
|
d8307d |
-.set __GI_memcpy,__memcpy_default
|
|
|
d8307d |
-.globl __GI_mempcpy
|
|
|
d8307d |
-.set __GI_mempcpy,____mempcpy_default
|
|
|
d8307d |
-.globl __GI___mempcpy
|
|
|
d8307d |
-.set __GI___mempcpy,____mempcpy_default
|
|
|
d8307d |
-#else
|
|
|
d8307d |
-.globl memcpy
|
|
|
d8307d |
-.set memcpy,__memcpy_default
|
|
|
d8307d |
-.weak mempcpy
|
|
|
d8307d |
-.set mempcpy,__mempcpy
|
|
|
d8307d |
-#endif
|