1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

PowerPC: optimized strcspn for PPC64/POWER7

This patch add a optimized strcspn for POWER7 by using a different
algorithm than default implementation: it constructs a table based on
the 'accept' argument and use this table to check for any occurance
on the input string. The idea is similar as x86_64 uses.
For PowerPC some tunings were added, such as unroll loops and align
stack memory to table to 16 bytes (so VSX clean can ran without
alignment issues).
This commit is contained in:
Adhemerval Zanella
2014-03-20 11:24:52 -05:00
parent ae3a5dff0f
commit 6eaf95cbfa
8 changed files with 271 additions and 16 deletions

View File

@ -15,27 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if defined _LIBC || HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
# ifndef strchr
# define strchr index
# endif
#endif
#include <string.h>
#undef strcspn
#ifndef STRCSPN
# define STRCSPN strcspn
#endif
/* Return the length of the maximum initial segment of S
which contains no characters from REJECT. */
size_t
strcspn (s, reject)
const char *s;
const char *reject;
STRCSPN (const char *s, const char *reject)
{
size_t count = 0;