powerpc64le: Optimized strcat for POWER10

This patch adds an optimized strcat which makes use of the default
strcat function which calls the Power10 strcpy and strlen routines.
This commit is contained in:
Mahesh Bodapati 2024-11-19 15:57:35 -05:00 committed by Peter Bergner
parent 229265cc2c
commit 3ef7e42861
4 changed files with 56 additions and 9 deletions

View File

@ -34,8 +34,9 @@ ifneq (,$(filter %le,$(config-machine)))
sysdep_routines += memchr-power10 memcmp-power10 memcpy-power10 \
memmove-power10 memset-power10 rawmemchr-power9 \
rawmemchr-power10 strcmp-power9 strcmp-power10 \
strncmp-power9 strncmp-power10 strcpy-power9 stpcpy-power9 \
strlen-power9 strncpy-power9 stpncpy-power9 strlen-power10
strncmp-power9 strncmp-power10 strcpy-power9 strcat-power10 \
stpcpy-power9 strlen-power9 strncpy-power9 stpncpy-power9 \
strlen-power10
endif
CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops

View File

@ -406,6 +406,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
/* Support sysdeps/powerpc/powerpc64/multiarch/strcat.c. */
IFUNC_IMPL (i, name, strcat,
#ifdef __LITTLE_ENDIAN__
IFUNC_IMPL_ADD (array, i, strcat, hwcap2 & PPC_FEATURE2_ARCH_3_1
&& hwcap & PPC_FEATURE_HAS_VSX,
__strcat_power10)
#endif
IFUNC_IMPL_ADD (array, i, strcat,
hwcap2 & PPC_FEATURE2_ARCH_2_07
&& hwcap & PPC_FEATURE_HAS_VSX,

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/ >. */
#ifdef __LITTLE_ENDIAN__
#include <string.h>
#define STRCAT __strcat_power10
#undef libc_hidden_def
#define libc_hidden_def(name)
extern typeof (strcpy) __strcpy_power9;
extern typeof (strlen) __strlen_power10;
#define strcpy __strcpy_power9
#define strlen __strlen_power10
#include <string/strcat.c>
#endif

View File

@ -25,14 +25,22 @@
extern __typeof (strcat) __strcat_ppc attribute_hidden;
extern __typeof (strcat) __strcat_power7 attribute_hidden;
extern __typeof (strcat) __strcat_power8 attribute_hidden;
#ifdef __LITTLE_ENDIAN__
extern __typeof (strcat) __strcat_power10 attribute_hidden;
#endif
# undef strcat
libc_ifunc_redirected (__redirect_strcat, strcat,
(hwcap2 & PPC_FEATURE2_ARCH_2_07
&& hwcap & PPC_FEATURE_HAS_VSX)
? __strcat_power8
: (hwcap & PPC_FEATURE_ARCH_2_06
&& hwcap & PPC_FEATURE_HAS_VSX)
? __strcat_power7
: __strcat_ppc);
#ifdef __LITTLE_ENDIAN__
(hwcap2 & PPC_FEATURE2_ARCH_3_1
&& hwcap & PPC_FEATURE_HAS_VSX)
? __strcat_power10 :
#endif
(hwcap2 & PPC_FEATURE2_ARCH_2_07
&& hwcap & PPC_FEATURE_HAS_VSX)
? __strcat_power8
: (hwcap & PPC_FEATURE_ARCH_2_06
&& hwcap & PPC_FEATURE_HAS_VSX)
? __strcat_power7
: __strcat_ppc);
#endif