diff options
author | Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> | 2018-08-16 12:12:02 +0530 |
---|---|---|
committer | Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> | 2018-08-16 12:12:02 +0530 |
commit | 7793ad7a2c00434398aa8bb3f5932e2fdf43536a (patch) | |
tree | 4adb3fc19bdde52c7ccdc0f110646cf18de8a32d | |
parent | 436e4d5b965abe592d26150cb518accf9ded8fe4 (diff) | |
download | glibc-7793ad7a2c00434398aa8bb3f5932e2fdf43536a.tar.gz glibc-7793ad7a2c00434398aa8bb3f5932e2fdf43536a.tar.xz glibc-7793ad7a2c00434398aa8bb3f5932e2fdf43536a.zip |
powerpc: Rearrange little endian specific files
This patch moves little endian specific POWER9 optimization files to sysdeps/powerpc/powerpc64/le and creates POWER9 ifunc functions only for little endian.
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/le/power9/strcmp.S (renamed from sysdeps/powerpc/powerpc64/power9/strcmp.S) | 14 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/le/power9/strncmp.S (renamed from sysdeps/powerpc/powerpc64/power9/strncmp.S) | 14 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/Makefile | 7 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strcmp.c | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S | 4 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strncmp.c | 4 |
9 files changed, 53 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog index 3815943fa7..dedffaa9d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2018-08-16 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> + + * sysdeps/powerpc/powerpc64/multiarch/Makefile + (sysdep_routines): Build strcmp-power9 and strncmp-power9 + only for little endian. + * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c + (strncmp): Move __strncmp_power9 inside ifdef __LITTLE_ENDIAN__. + (STRCMP): Move __strcmp_power9 inside ifdef __LITTLE_ENDIAN__. + * sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: + Add check for little endian. + * sysdeps/powerpc/powerpc64/multiarch/strcmp.c + (__strcmp_power9): Add check for little endian. + * sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: + Add check for little endian. + * sysdeps/powerpc/powerpc64/multiarch/strncmp.c + (__strncmp_power9): Add check for little endian. + * sysdeps/powerpc/powerpc64/power9/strcmp.S: Removed ifdef + __LITTLE_ENDIAN__ and moved to sysdeps/powerpc/powerpc64/le/power9. + * sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise. + * sysdeps/powerpc/powerpc64/le/power9/strcmp.S: New file. + * sysdeps/powerpc/powerpc64/le/power9/strncmp.S: Likewise. + 2018-08-15 Siddhesh Poyarekar <siddhesh@sourceware.org> * sysdeps/aarch64/strlen.S (__strlen): Rename to STRLEN. diff --git a/sysdeps/powerpc/powerpc64/power9/strcmp.S b/sysdeps/powerpc/powerpc64/le/power9/strcmp.S index 98243a9d51..bf057f598e 100644 --- a/sysdeps/powerpc/powerpc64/power9/strcmp.S +++ b/sysdeps/powerpc/powerpc64/le/power9/strcmp.S @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#ifdef __LITTLE_ENDIAN__ #include <sysdep.h> #ifndef STRCMP @@ -30,16 +29,16 @@ as in POWER8 patch and uses vectorised loops after that. */ /* TODO: Change this to actual instructions when minimum binutils is upgraded - to 2.27. Macros are defined below for these newer instructions in order + to 2.27. Macros are defined below for these newer instructions in order to maintain compatibility. */ -# define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21))) +#define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21))) -# define VEXTUBRX(t,a,b) .long (0x1000070d \ +#define VEXTUBRX(t,a,b) .long (0x1000070d \ | ((t)<<(32-11)) \ | ((a)<<(32-16)) \ | ((b)<<(32-21)) ) -# define VCMPNEZB(t,a,b) .long (0x10000507 \ +#define VCMPNEZB(t,a,b) .long (0x10000507 \ | ((t)<<(32-11)) \ | ((a)<<(32-16)) \ | ((b)<<(32-21)) ) @@ -48,7 +47,7 @@ reg1: Vector to hold next 16 bytes. reg2: Address to read from. reg3: Permute control vector. */ -# define GET16BYTES(reg1, reg2, reg3) \ +#define GET16BYTES(reg1, reg2, reg3) \ lvx reg1, 0, reg2; \ vperm v8, v2, reg1, reg3; \ vcmpequb. v8, v0, v8; \ @@ -263,6 +262,3 @@ L(pagecross_nullfound): b L(pagecross_retdiff) END (STRCMP) libc_hidden_builtin_def (strcmp) -#else -#include <sysdeps/powerpc/powerpc64/power8/strcmp.S> -#endif diff --git a/sysdeps/powerpc/powerpc64/power9/strncmp.S b/sysdeps/powerpc/powerpc64/le/power9/strncmp.S index 40be98ff45..93a79343c6 100644 --- a/sysdeps/powerpc/powerpc64/power9/strncmp.S +++ b/sysdeps/powerpc/powerpc64/le/power9/strncmp.S @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#ifdef __LITTLE_ENDIAN__ #include <sysdep.h> /* Implements the function @@ -31,16 +30,16 @@ #endif /* TODO: Change this to actual instructions when minimum binutils is upgraded - to 2.27. Macros are defined below for these newer instructions in order + to 2.27. Macros are defined below for these newer instructions in order to maintain compatibility. */ -# define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21))) +#define VCTZLSBB(r,v) .long (0x10010602 | ((r)<<(32-11)) | ((v)<<(32-21))) -# define VEXTUBRX(t,a,b) .long (0x1000070d \ +#define VEXTUBRX(t,a,b) .long (0x1000070d \ | ((t)<<(32-11)) \ | ((a)<<(32-16)) \ | ((b)<<(32-21)) ) -# define VCMPNEZB(t,a,b) .long (0x10000507 \ +#define VCMPNEZB(t,a,b) .long (0x10000507 \ | ((t)<<(32-11)) \ | ((a)<<(32-16)) \ | ((b)<<(32-21)) ) @@ -49,7 +48,7 @@ reg1: Vector to hold next 16 bytes. reg2: Address to read from. reg3: Permute control vector. */ -# define GET16BYTES(reg1, reg2, reg3) \ +#define GET16BYTES(reg1, reg2, reg3) \ lvx reg1, 0, reg2; \ vperm v8, v2, reg1, reg3; \ vcmpequb. v8, v0, v8; \ @@ -374,6 +373,3 @@ L(byte_ne_3): b L(byte_ne_1) END(STRNCMP) libc_hidden_builtin_def(strncmp) -#else -#include <sysdeps/powerpc/powerpc64/power8/strncmp.S> -#endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile index 4df6b45c4c..963ea84dbf 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile @@ -12,7 +12,7 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \ strnlen-power8 strnlen-power7 strnlen-ppc64 \ strcasecmp-power7 strcasecmp_l-power7 \ strncase-power7 strncase_l-power7 \ - strncmp-power9 strncmp-power8 strncmp-power7 \ + strncmp-power8 strncmp-power7 \ strncmp-power4 strncmp-ppc64 \ strchr-power8 strchr-power7 strchr-ppc64 \ strchrnul-power8 strchrnul-power7 strchrnul-ppc64 \ @@ -22,7 +22,7 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \ strncat-power8 strncat-power7 strncat-ppc64 \ strncpy-power7 strncpy-ppc64 \ stpncpy-power8 stpncpy-power7 stpncpy-ppc64 \ - strcmp-power9 strcmp-power8 strcmp-power7 strcmp-ppc64 \ + strcmp-power8 strcmp-power7 strcmp-ppc64 \ strcat-power8 strcat-power7 strcat-ppc64 \ memmove-power7 memmove-ppc64 wordcopy-ppc64 bcopy-ppc64 \ strncpy-power8 strstr-power7 strstr-ppc64 \ @@ -31,6 +31,9 @@ sysdep_routines += memcpy-power8-cached memcpy-power7 memcpy-a2 memcpy-power6 \ strcasecmp-ppc64 strcasecmp-power8 strncase-ppc64 \ strncase-power8 +ifneq (,$(filter %le,$(config-machine))) +sysdep_routines += strcmp-power9 strncmp-power9 +endif CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c index 38a21e478e..1d374f2ae4 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c @@ -112,8 +112,10 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, /* Support sysdeps/powerpc/powerpc64/multiarch/strncmp.c. */ IFUNC_IMPL (i, name, strncmp, +#ifdef __LITTLE_ENDIAN__ IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_3_00, __strncmp_power9) +#endif IFUNC_IMPL_ADD (array, i, strncmp, hwcap2 & PPC_FEATURE2_ARCH_2_07, __strncmp_power8) IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX, @@ -337,9 +339,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, /* Support sysdeps/powerpc/powerpc64/multiarch/strcmp.c. */ IFUNC_IMPL (i, name, strcmp, +#ifdef __LITTLE_ENDIAN__ IFUNC_IMPL_ADD (array, i, strcmp, hwcap2 & PPC_FEATURE2_ARCH_3_00, __strcmp_power9) +#endif IFUNC_IMPL_ADD (array, i, strcmp, hwcap2 & PPC_FEATURE2_ARCH_2_07, __strcmp_power8) diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S b/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S index 8b569d38be..545e6cee91 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S +++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S @@ -16,11 +16,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if IS_IN (libc) +#if defined __LITTLE_ENDIAN__ && IS_IN (libc) #define STRCMP __strcmp_power9 #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(name) -#include <sysdeps/powerpc/powerpc64/power9/strcmp.S> +#include <sysdeps/powerpc/powerpc64/le/power9/strcmp.S> #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c index b669053166..2422c8d72c 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c @@ -27,13 +27,17 @@ extern __typeof (strcmp) __strcmp_ppc attribute_hidden; extern __typeof (strcmp) __strcmp_power7 attribute_hidden; extern __typeof (strcmp) __strcmp_power8 attribute_hidden; +# ifdef __LITTLE_ENDIAN__ extern __typeof (strcmp) __strcmp_power9 attribute_hidden; +# endif # undef strcmp libc_ifunc_redirected (__redirect_strcmp, strcmp, +# ifdef __LITTLE_ENDIAN__ (hwcap2 & PPC_FEATURE2_ARCH_3_00) ? __strcmp_power9 : +# endif (hwcap2 & PPC_FEATURE2_ARCH_2_07) ? __strcmp_power8 : (hwcap & PPC_FEATURE_HAS_VSX) diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S b/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S index 3356f72527..c6f0128379 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S +++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S @@ -15,11 +15,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#if IS_IN (libc) +#if defined __LITTLE_ENDIAN__ && IS_IN (libc) #define STRNCMP __strncmp_power9 #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(name) -#include <sysdeps/powerpc/powerpc64/power9/strncmp.S> +#include <sysdeps/powerpc/powerpc64/le/power9/strncmp.S> #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c index c4a40d1ec7..9c887ee181 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c @@ -29,14 +29,18 @@ extern __typeof (strncmp) __strncmp_ppc attribute_hidden; extern __typeof (strncmp) __strncmp_power4 attribute_hidden; extern __typeof (strncmp) __strncmp_power7 attribute_hidden; extern __typeof (strncmp) __strncmp_power8 attribute_hidden; +# ifdef __LITTLE_ENDIAN__ extern __typeof (strncmp) __strncmp_power9 attribute_hidden; +# endif # undef strncmp /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ libc_ifunc_redirected (__redirect_strncmp, strncmp, +# ifdef __LITTLE_ENDIAN_ (hwcap2 & PPC_FEATURE2_ARCH_3_00) ? __strncmp_power9 : +# endif (hwcap2 & PPC_FEATURE2_ARCH_2_07) ? __strncmp_power8 : (hwcap & PPC_FEATURE_HAS_VSX) |