Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 4 Oct 1999 06:16:19 +0000 (06:16 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 4 Oct 1999 06:16:19 +0000 (06:16 +0000)
1999-10-03  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/i386/i486/bits/string.h (__memrchr): New function.

* sysdeps/i386/bits/string.h (__memrchr): Add cld to comply to
conventions.

* string/Versions: Export memrchr.

ChangeLog
sysdeps/i386/bits/string.h
sysdeps/i386/i486/bits/string.h

index a28865f..e9f4a79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1999-10-03  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/i386/i486/bits/string.h (__memrchr): New function.
+
+       * sysdeps/i386/bits/string.h (__memrchr): Add cld to comply to
+       conventions.
+
+       * string/Versions: Export memrchr.
+
 1999-10-04  Roland McGrath  <roland@baalperazim.frob.com>
 
        * misc/Versions (GLIBC_2.2): Add getloadavg.
index 6fc78b3..01c17db 100644 (file)
@@ -300,7 +300,8 @@ memchr (__const void *__s, int __c, size_t __n)
      "movl $1,%0\n"
      "1:"
      : "=D" (__res), "=&c" (__d0)
-     : "a" (__c), "0" (__s), "1" (__n));
+     : "a" (__c), "0" (__s), "1" (__n)
+     : "cc");
   return __res - 1;
 }
 #endif
@@ -319,9 +320,10 @@ __memrchr (__const void *__s, int __c, size_t __n)
      "repne; scasb\n\t"
      "je 1f\n\t"
      "movl $1,%0\n"
-     "1:"
+     "1:\tcld"
      : "=D" (__res), "=&c" (__d0)
-     : "a" (__c), "0" (__s), "1" (__n));
+     : "a" (__c), "0" (__s), "1" (__n)
+     : "cc");
   return __res - 1;
 }
 #endif
index 644967c..9b37f58 100644 (file)
@@ -446,6 +446,42 @@ memchr (__const void *__s, int __c, size_t __n)
 }
 #endif
 
+#define _HAVE_STRING_ARCH_memrchr 1
+#ifndef _FORCE_INLINES
+__STRING_INLINE void *
+__memrchr (__const void *__s, int __c, size_t __n)
+{
+  register unsigned long int __d0;
+#ifdef __i686__
+  register unsigned long int __d1;
+#endif
+  register void *__res;
+  if (__n == 0)
+    return NULL;
+#ifdef __i686__
+  __asm__ __volatile__
+    ("std\n\t"
+     "repne; scasb\n\t"
+     "cmovne %2,%0\n\t"
+     "cld"
+     : "=D" (__res), "=&c" (__d0), "=&r" (__d1)
+     : "a" (__c), "0" (__s), "1" (__n), "2" (1)
+     : "cc");
+#else
+  __asm__ __volatile__
+    ("std\n\t"
+     "repne; scasb\n\t"
+     "je 1f\n\t"
+     "movl $1,%0\n"
+     "1:\tcld"
+     : "=D" (__res), "=&c" (__d0)
+     : "a" (__c), "0" (__s), "1" (__n)
+     : "cc");
+#endif
+  return __res - 1;
+}
+#endif
+
 /* Return pointer to C in S.  */
 #define _HAVE_STRING_ARCH_rawmemchr 1
 __STRING_INLINE void *__rawmemchr (const void *__s, int __c);