summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2009-07-02 03:39:03 -0700
committerUlrich Drepper <drepper@redhat.com>2009-07-02 03:39:03 -0700
commitab6a873fe07b8ded403bc5a5ca73be5d04820d61 (patch)
tree82c30accc8655738ef1831579a1d3c1e93270cf2 /string
parent6cbbaa50aac809ad6e0692247876c82d58e466bf (diff)
downloadglibc-ab6a873fe07b8ded403bc5a5ca73be5d04820d61.tar.gz
glibc-ab6a873fe07b8ded403bc5a5ca73be5d04820d61.tar.xz
glibc-ab6a873fe07b8ded403bc5a5ca73be5d04820d61.zip
SSSE3 strcpy/stpcpy for x86-64
This patch adds SSSE3 strcpy/stpcpy. I got up to 4X speed up on Core 2
and Core i7.  I disabled it on Atom since SSSE3 version is slower for
shorter (<64byte) data.
Diffstat (limited to 'string')
-rw-r--r--string/stpncpy.c15
-rw-r--r--string/strncpy.c9
2 files changed, 13 insertions, 11 deletions
diff --git a/string/stpncpy.c b/string/stpncpy.c
index 164d0f1747..2ebab33d8a 100644
--- a/string/stpncpy.c
+++ b/string/stpncpy.c
@@ -28,17 +28,19 @@
 # include <sys/types.h>
 #endif
 
-#ifndef weak_alias
-# define __stpncpy stpncpy
+#ifndef STPNCPY
+# ifdef weak_alias
+#  define STPNCPY	__stpncpy
+weak_alias (__stpncpy, stpncpy)
+# else
+#  define STPNCPY	stpncpy
+# endif
 #endif
 
 /* Copy no more than N characters of SRC to DEST, returning the address of
    the terminating '\0' in DEST, if any, or else DEST + N.  */
 char *
-__stpncpy (dest, src, n)
-     char *dest;
-     const char *src;
-     size_t n;
+STPNCPY (char *dest, const char *src, size_t n)
 {
   char c;
   char *s = dest;
@@ -96,5 +98,4 @@ __stpncpy (dest, src, n)
 }
 #ifdef weak_alias
 libc_hidden_def (__stpncpy)
-weak_alias (__stpncpy, stpncpy)
 #endif
diff --git a/string/strncpy.c b/string/strncpy.c
index f32612e1cf..2274d7d31e 100644
--- a/string/strncpy.c
+++ b/string/strncpy.c
@@ -21,11 +21,12 @@
 
 #undef strncpy
 
+#ifndef STRNCPY
+#define STRNCPY strncpy
+#endif
+
 char *
-strncpy (s1, s2, n)
-     char *s1;
-     const char *s2;
-     size_t n;
+STRNCPY (char *s1, const char *s2, size_t n)
 {
   reg_char c;
   char *s = s1;