|
|
3b386f |
commit 7793ad7a2c00434398aa8bb3f5932e2fdf43536a
|
|
|
3b386f |
Author: Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
|
|
|
3b386f |
Date: Thu Aug 16 12:12:02 2018 +0530
|
|
|
3b386f |
|
|
|
3b386f |
powerpc: Rearrange little endian specific files
|
|
|
3b386f |
|
|
|
3b386f |
This patch moves little endian specific POWER9 optimization files to
|
|
|
3b386f |
sysdeps/powerpc/powerpc64/le and creates POWER9 ifunc functions
|
|
|
3b386f |
only for little endian.
|
|
|
3b386f |
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/power9/strcmp.S b/sysdeps/powerpc/powerpc64/le/power9/strcmp.S
|
|
|
3b386f |
similarity index 93%
|
|
|
3b386f |
rename from sysdeps/powerpc/powerpc64/power9/strcmp.S
|
|
|
3b386f |
rename to sysdeps/powerpc/powerpc64/le/power9/strcmp.S
|
|
|
3b386f |
index 98243a9d51e1577f..bf057f598ef2aa55 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/power9/strcmp.S
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/le/power9/strcmp.S
|
|
|
3b386f |
@@ -15,7 +15,6 @@
|
|
|
3b386f |
You should have received a copy of the GNU Lesser General Public
|
|
|
3b386f |
License along with the GNU C Library; if not, see
|
|
|
3b386f |
<http://www.gnu.org/licenses/>. */
|
|
|
3b386f |
-#ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
#include <sysdep.h>
|
|
|
3b386f |
|
|
|
3b386f |
#ifndef STRCMP
|
|
|
3b386f |
@@ -30,16 +29,16 @@
|
|
|
3b386f |
as in POWER8 patch and uses vectorised loops after that. */
|
|
|
3b386f |
|
|
|
3b386f |
/* TODO: Change this to actual instructions when minimum binutils is upgraded
|
|
|
3b386f |
- to 2.27. Macros are defined below for these newer instructions in order
|
|
|
3b386f |
+ to 2.27. Macros are defined below for these newer instructions in order
|
|
|
3b386f |
to maintain compatibility. */
|
|
|
3b386f |
-# define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21)))
|
|
|
3b386f |
+#define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21)))
|
|
|
3b386f |
|
|
|
3b386f |
-# define VEXTUBRX(t,a,b) .long (0x1000070d \
|
|
|
3b386f |
+#define VEXTUBRX(t,a,b) .long (0x1000070d \
|
|
|
3b386f |
| ((t)<<(32-11)) \
|
|
|
3b386f |
| ((a)<<(32-16)) \
|
|
|
3b386f |
| ((b)<<(32-21)) )
|
|
|
3b386f |
|
|
|
3b386f |
-# define VCMPNEZB(t,a,b) .long (0x10000507 \
|
|
|
3b386f |
+#define VCMPNEZB(t,a,b) .long (0x10000507 \
|
|
|
3b386f |
| ((t)<<(32-11)) \
|
|
|
3b386f |
| ((a)<<(32-16)) \
|
|
|
3b386f |
| ((b)<<(32-21)) )
|
|
|
3b386f |
@@ -48,7 +47,7 @@
|
|
|
3b386f |
reg1: Vector to hold next 16 bytes.
|
|
|
3b386f |
reg2: Address to read from.
|
|
|
3b386f |
reg3: Permute control vector. */
|
|
|
3b386f |
-# define GET16BYTES(reg1, reg2, reg3) \
|
|
|
3b386f |
+#define GET16BYTES(reg1, reg2, reg3) \
|
|
|
3b386f |
lvx reg1, 0, reg2; \
|
|
|
3b386f |
vperm v8, v2, reg1, reg3; \
|
|
|
3b386f |
vcmpequb. v8, v0, v8; \
|
|
|
3b386f |
@@ -263,6 +262,3 @@ L(pagecross_nullfound):
|
|
|
3b386f |
b L(pagecross_retdiff)
|
|
|
3b386f |
END (STRCMP)
|
|
|
3b386f |
libc_hidden_builtin_def (strcmp)
|
|
|
3b386f |
-#else
|
|
|
3b386f |
-#include <sysdeps/powerpc/powerpc64/power8/strcmp.S>
|
|
|
3b386f |
-#endif
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/power9/strncmp.S b/sysdeps/powerpc/powerpc64/le/power9/strncmp.S
|
|
|
3b386f |
similarity index 95%
|
|
|
3b386f |
rename from sysdeps/powerpc/powerpc64/power9/strncmp.S
|
|
|
3b386f |
rename to sysdeps/powerpc/powerpc64/le/power9/strncmp.S
|
|
|
3b386f |
index 40be98ff45c9f485..93a79343c6be1099 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/power9/strncmp.S
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/le/power9/strncmp.S
|
|
|
3b386f |
@@ -15,7 +15,6 @@
|
|
|
3b386f |
You should have received a copy of the GNU Lesser General Public
|
|
|
3b386f |
License along with the GNU C Library; if not, see
|
|
|
3b386f |
<http://www.gnu.org/licenses/>. */
|
|
|
3b386f |
-#ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
#include <sysdep.h>
|
|
|
3b386f |
|
|
|
3b386f |
/* Implements the function
|
|
|
3b386f |
@@ -31,16 +30,16 @@
|
|
|
3b386f |
#endif
|
|
|
3b386f |
|
|
|
3b386f |
/* TODO: Change this to actual instructions when minimum binutils is upgraded
|
|
|
3b386f |
- to 2.27. Macros are defined below for these newer instructions in order
|
|
|
3b386f |
+ to 2.27. Macros are defined below for these newer instructions in order
|
|
|
3b386f |
to maintain compatibility. */
|
|
|
3b386f |
-# define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21)))
|
|
|
3b386f |
+#define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21)))
|
|
|
3b386f |
|
|
|
3b386f |
-# define VEXTUBRX(t,a,b) .long (0x1000070d \
|
|
|
3b386f |
+#define VEXTUBRX(t,a,b) .long (0x1000070d \
|
|
|
3b386f |
| ((t)<<(32-11)) \
|
|
|
3b386f |
| ((a)<<(32-16)) \
|
|
|
3b386f |
| ((b)<<(32-21)) )
|
|
|
3b386f |
|
|
|
3b386f |
-# define VCMPNEZB(t,a,b) .long (0x10000507 \
|
|
|
3b386f |
+#define VCMPNEZB(t,a,b) .long (0x10000507 \
|
|
|
3b386f |
| ((t)<<(32-11)) \
|
|
|
3b386f |
| ((a)<<(32-16)) \
|
|
|
3b386f |
| ((b)<<(32-21)) )
|
|
|
3b386f |
@@ -49,7 +48,7 @@
|
|
|
3b386f |
reg1: Vector to hold next 16 bytes.
|
|
|
3b386f |
reg2: Address to read from.
|
|
|
3b386f |
reg3: Permute control vector. */
|
|
|
3b386f |
-# define GET16BYTES(reg1, reg2, reg3) \
|
|
|
3b386f |
+#define GET16BYTES(reg1, reg2, reg3) \
|
|
|
3b386f |
lvx reg1, 0, reg2; \
|
|
|
3b386f |
vperm v8, v2, reg1, reg3; \
|
|
|
3b386f |
vcmpequb. v8, v0, v8; \
|
|
|
3b386f |
@@ -374,6 +373,3 @@ L(byte_ne_3):
|
|
|
3b386f |
b L(byte_ne_1)
|
|
|
3b386f |
END(STRNCMP)
|
|
|
3b386f |
libc_hidden_builtin_def(strncmp)
|
|
|
3b386f |
-#else
|
|
|
3b386f |
-#include <sysdeps/powerpc/powerpc64/power8/strncmp.S>
|
|
|
3b386f |
-#endif
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
3b386f |
index 4df6b45c4c1c495a..963ea84dbfa98c74 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile
|
|
|
3b386f |
@@ -12,7 +12,7 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \
|
|
|
3b386f |
strnlen-power8 strnlen-power7 strnlen-ppc64 \
|
|
|
3b386f |
strcasecmp-power7 strcasecmp_l-power7 \
|
|
|
3b386f |
strncase-power7 strncase_l-power7 \
|
|
|
3b386f |
- strncmp-power9 strncmp-power8 strncmp-power7 \
|
|
|
3b386f |
+ strncmp-power8 strncmp-power7 \
|
|
|
3b386f |
strncmp-power4 strncmp-ppc64 \
|
|
|
3b386f |
strchr-power8 strchr-power7 strchr-ppc64 \
|
|
|
3b386f |
strchrnul-power8 strchrnul-power7 strchrnul-ppc64 \
|
|
|
3b386f |
@@ -22,7 +22,7 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \
|
|
|
3b386f |
strncat-power8 strncat-power7 strncat-ppc64 \
|
|
|
3b386f |
strncpy-power7 strncpy-ppc64 \
|
|
|
3b386f |
stpncpy-power8 stpncpy-power7 stpncpy-ppc64 \
|
|
|
3b386f |
- strcmp-power9 strcmp-power8 strcmp-power7 strcmp-ppc64 \
|
|
|
3b386f |
+ strcmp-power8 strcmp-power7 strcmp-ppc64 \
|
|
|
3b386f |
strcat-power8 strcat-power7 strcat-ppc64 \
|
|
|
3b386f |
memmove-power7 memmove-ppc64 wordcopy-ppc64 bcopy-ppc64 \
|
|
|
3b386f |
strncpy-power8 strstr-power7 strstr-ppc64 \
|
|
|
3b386f |
@@ -31,6 +31,9 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \
|
|
|
3b386f |
strcasecmp-ppc64 strcasecmp-power8 strncase-ppc64 \
|
|
|
3b386f |
strncase-power8
|
|
|
3b386f |
|
|
|
3b386f |
+ifneq (,$(filter %le,$(config-machine)))
|
|
|
3b386f |
+sysdep_routines += strcmp-power9 strncmp-power9
|
|
|
3b386f |
+endif
|
|
|
3b386f |
CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
|
|
|
3b386f |
CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
|
|
|
3b386f |
endif
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
3b386f |
index 38a21e478e2527f5..1d374f2ae48165bd 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
|
|
|
3b386f |
@@ -112,8 +112,10 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
3b386f |
|
|
|
3b386f |
/* Support sysdeps/powerpc/powerpc64/multiarch/strncmp.c. */
|
|
|
3b386f |
IFUNC_IMPL (i, name, strncmp,
|
|
|
3b386f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_3_00,
|
|
|
3b386f |
__strncmp_power9)
|
|
|
3b386f |
+#endif
|
|
|
3b386f |
IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_2_07,
|
|
|
3b386f |
__strncmp_power8)
|
|
|
3b386f |
IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX,
|
|
|
3b386f |
@@ -337,9 +339,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
3b386f |
|
|
|
3b386f |
/* Support sysdeps/powerpc/powerpc64/multiarch/strcmp.c. */
|
|
|
3b386f |
IFUNC_IMPL (i, name, strcmp,
|
|
|
3b386f |
+#ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
IFUNC_IMPL_ADD (array, i, strcmp,
|
|
|
3b386f |
hwcap2 & PPC_FEATURE2_ARCH_3_00,
|
|
|
3b386f |
__strcmp_power9)
|
|
|
3b386f |
+#endif
|
|
|
3b386f |
IFUNC_IMPL_ADD (array, i, strcmp,
|
|
|
3b386f |
hwcap2 & PPC_FEATURE2_ARCH_2_07,
|
|
|
3b386f |
__strcmp_power8)
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S b/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S
|
|
|
3b386f |
index 8b569d38be783316..545e6cee91e61311 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S
|
|
|
3b386f |
@@ -16,11 +16,11 @@
|
|
|
3b386f |
License along with the GNU C Library; if not, see
|
|
|
3b386f |
<http://www.gnu.org/licenses/>. */
|
|
|
3b386f |
|
|
|
3b386f |
-#if IS_IN (libc)
|
|
|
3b386f |
+#if defined __LITTLE_ENDIAN__ && IS_IN (libc)
|
|
|
3b386f |
#define STRCMP __strcmp_power9
|
|
|
3b386f |
|
|
|
3b386f |
#undef libc_hidden_builtin_def
|
|
|
3b386f |
#define libc_hidden_builtin_def(name)
|
|
|
3b386f |
|
|
|
3b386f |
-#include <sysdeps/powerpc/powerpc64/power9/strcmp.S>
|
|
|
3b386f |
+#include <sysdeps/powerpc/powerpc64/le/power9/strcmp.S>
|
|
|
3b386f |
#endif
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
|
|
|
3b386f |
index b669053166771cae..2422c8d72cfdec83 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
|
|
|
3b386f |
@@ -27,13 +27,17 @@
|
|
|
3b386f |
extern __typeof (strcmp) __strcmp_ppc attribute_hidden;
|
|
|
3b386f |
extern __typeof (strcmp) __strcmp_power7 attribute_hidden;
|
|
|
3b386f |
extern __typeof (strcmp) __strcmp_power8 attribute_hidden;
|
|
|
3b386f |
+# ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
extern __typeof (strcmp) __strcmp_power9 attribute_hidden;
|
|
|
3b386f |
+# endif
|
|
|
3b386f |
|
|
|
3b386f |
# undef strcmp
|
|
|
3b386f |
|
|
|
3b386f |
libc_ifunc_redirected (__redirect_strcmp, strcmp,
|
|
|
3b386f |
+# ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
(hwcap2 & PPC_FEATURE2_ARCH_3_00)
|
|
|
3b386f |
? __strcmp_power9 :
|
|
|
3b386f |
+# endif
|
|
|
3b386f |
(hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
|
|
3b386f |
? __strcmp_power8
|
|
|
3b386f |
: (hwcap & PPC_FEATURE_HAS_VSX)
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S b/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S
|
|
|
3b386f |
index 3356f7252771a043..c6f0128379c497b4 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S
|
|
|
3b386f |
@@ -15,11 +15,11 @@
|
|
|
3b386f |
License along with the GNU C Library; if not, see
|
|
|
3b386f |
<http://www.gnu.org/licenses/>. */
|
|
|
3b386f |
|
|
|
3b386f |
-#if IS_IN (libc)
|
|
|
3b386f |
+#if defined __LITTLE_ENDIAN__ && IS_IN (libc)
|
|
|
3b386f |
#define STRNCMP __strncmp_power9
|
|
|
3b386f |
|
|
|
3b386f |
#undef libc_hidden_builtin_def
|
|
|
3b386f |
#define libc_hidden_builtin_def(name)
|
|
|
3b386f |
|
|
|
3b386f |
-#include <sysdeps/powerpc/powerpc64/power9/strncmp.S>
|
|
|
3b386f |
+#include <sysdeps/powerpc/powerpc64/le/power9/strncmp.S>
|
|
|
3b386f |
#endif
|
|
|
3b386f |
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
|
|
|
3b386f |
index c4a40d1ec7245a3b..9c887ee18186f070 100644
|
|
|
3b386f |
--- a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
|
|
|
3b386f |
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
|
|
|
3b386f |
@@ -29,14 +29,18 @@ extern __typeof (strncmp) __strncmp_ppc attribute_hidden;
|
|
|
3b386f |
extern __typeof (strncmp) __strncmp_power4 attribute_hidden;
|
|
|
3b386f |
extern __typeof (strncmp) __strncmp_power7 attribute_hidden;
|
|
|
3b386f |
extern __typeof (strncmp) __strncmp_power8 attribute_hidden;
|
|
|
3b386f |
+# ifdef __LITTLE_ENDIAN__
|
|
|
3b386f |
extern __typeof (strncmp) __strncmp_power9 attribute_hidden;
|
|
|
3b386f |
+# endif
|
|
|
3b386f |
# undef strncmp
|
|
|
3b386f |
|
|
|
3b386f |
/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
|
|
|
3b386f |
ifunc symbol properly. */
|
|
|
3b386f |
libc_ifunc_redirected (__redirect_strncmp, strncmp,
|
|
|
3b386f |
+# ifdef __LITTLE_ENDIAN_
|
|
|
3b386f |
(hwcap2 & PPC_FEATURE2_ARCH_3_00)
|
|
|
3b386f |
? __strncmp_power9 :
|
|
|
3b386f |
+# endif
|
|
|
3b386f |
(hwcap2 & PPC_FEATURE2_ARCH_2_07)
|
|
|
3b386f |
? __strncmp_power8
|
|
|
3b386f |
: (hwcap & PPC_FEATURE_HAS_VSX)
|