From 6eaf95cbfa0031ea267682dc2c9c17ed3e3dc167 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 20 Mar 2014 11:24:52 -0500 Subject: 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). --- string/strcspn.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'string') diff --git a/string/strcspn.c b/string/strcspn.c index 7c39f793ea..431620521a 100644 --- a/string/strcspn.c +++ b/string/strcspn.c @@ -15,27 +15,18 @@ License along with the GNU C Library; if not, see . */ -#if HAVE_CONFIG_H -# include -#endif - -#if defined _LIBC || HAVE_STRING_H -# include -#else -# include -# ifndef strchr -# define strchr index -# endif -#endif +#include #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; -- cgit 1.4.1