about summary refs log tree commit diff
path: root/sysdeps/i386/i486/bits/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/i486/bits/string.h')
-rw-r--r--sysdeps/i386/i486/bits/string.h351
1 files changed, 195 insertions, 156 deletions
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index aaa636a56d..6690066d94 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -62,8 +62,8 @@
 __STRING_INLINE void *
 __memcpy_by4 (void *__dest, __const void *__src, size_t __n)
 {
+  register unsigned long int __d0, __d1;
   register void *__tmp = __dest;
-  register int __dummy1, __dummy2;
   __asm__ __volatile__
     ("1:\n\t"
      "movl	(%2),%0\n\t"
@@ -72,7 +72,7 @@ __memcpy_by4 (void *__dest, __const void *__src, size_t __n)
      "leal	4(%1),%1\n\t"
      "decl	%3\n\t"
      "jnz	1b"
-     : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&r" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
      : "1" (__tmp), "2" (__src), "3" (__n / 4)
      : "memory", "cc");
   return __dest;
@@ -81,8 +81,8 @@ __memcpy_by4 (void *__dest, __const void *__src, size_t __n)
 __STRING_INLINE void *
 __memcpy_by2 (void *__dest, __const void *__src, size_t __n)
 {
+  register unsigned long int __d0, __d1;
   register void *__tmp = __dest;
-  register int __dummy1, __dummy2;
   __asm__ __volatile__
     ("shrl	$1,%3\n\t"
      "jz	2f\n"                 /* only a word */
@@ -96,7 +96,7 @@ __memcpy_by2 (void *__dest, __const void *__src, size_t __n)
      "2:\n\t"
      "movw	(%2),%w0\n\t"
      "movw	%w0,(%1)"
-     : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&q" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
      : "1" (__tmp), "2" (__src), "3" (__n / 2)
      : "memory", "cc");
   return __dest;
@@ -105,6 +105,7 @@ __memcpy_by2 (void *__dest, __const void *__src, size_t __n)
 __STRING_INLINE void *
 __memcpy_g (void *__dest, __const void *__src, size_t __n)
 {
+  register unsigned long int __d0, __d1, __d2;
   register void *__tmp = __dest;
   __asm__ __volatile__
     ("cld\n\t"
@@ -117,9 +118,9 @@ __memcpy_g (void *__dest, __const void *__src, size_t __n)
      "movsw\n"
      "2:\n\t"
      "rep; movsl"
-     : /* no output */
-     : "c" (__n), "D" (__tmp),"S" (__src)
-     : "cx", "di", "si", "memory", "cc");
+     : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2)
+     : "0" (__n), "1" (__tmp), "2" (__src)
+     : "memory", "cc");
   return __dest;
 }
 
@@ -129,23 +130,24 @@ __memcpy_g (void *__dest, __const void *__src, size_t __n)
 __STRING_INLINE void *
 memmove (void *__dest, __const void *__src, size_t __n)
 {
+  register unsigned long int __d0, __d1, __d2;
   register void *__tmp = __dest;
   if (__dest < __src)
     __asm__ __volatile__
       ("cld\n\t"
        "rep; movsb"
-       : /* no output */
-       : "c" (__n), "S" (__src), "D" (__tmp)
-       : "cx", "si", "di");
+       : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
+       : "0" (__n), "1" (__src), "2" (__tmp)
+       : "memory");
   else
     __asm__ __volatile__
       ("std\n\t"
        "rep; movsb\n\t"
        "cld"
-       : /* no output */
-       : "c" (__n), "S" (__n - 1 + (__const char *) __src),
-	 "D" (__n - 1 + (char *) __tmp)
-       : "cx", "si", "di", "memory");
+       : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
+       : "0" (__n), "1" (__n - 1 + (__const char *) __src),
+	 "2" (__n - 1 + (char *) __tmp)
+       : "memory");
   return __dest;
 }
 
@@ -157,6 +159,7 @@ memmove (void *__dest, __const void *__src, size_t __n)
 __STRING_INLINE int
 memcmp (__const void *__s1, __const void *__s2, size_t __n)
 {
+  register unsigned long int __d0, __d1, __d2;
   register int __res;
   __asm__ __volatile__
     ("cld\n\t"
@@ -165,9 +168,9 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
      "sbbl	%0,%0\n\t"
      "orb	$1,%b0\n"
      "1:"
-     : "=a" (__res)
-     : "0" (0), "S" (__s1), "D" (__s2), "c" (__n)
-     : "si", "di", "cx", "cc");
+     : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
+     : "0" (0), "1" (__s1), "2" (__s2), "3" (__n)
+     : "cc");
   return __res;
 }
 #endif
@@ -203,15 +206,15 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
 __STRING_INLINE void *
 __memset_cc_by4 (void *__s, int __c, size_t __n)
 {
+  register unsigned long int __d0;
   register char *__tmp = __s;
-  register int __dummy;
   __asm__ __volatile__
     ("1:\n\t"
      "movl	%2,(%0)\n\t"
      "leal	4(%0),%0\n\t"
      "decl	%1\n\t"
      "jnz	1b"
-     : "=r" (__tmp), "=r" (__dummy)
+     : "=&r" (__tmp), "=&r" (__d0)
      : "q" (0x01010101UL * (unsigned char) __c), "0" (__tmp), "1" (__n / 4)
      : "memory", "cc");
   return __s;
@@ -220,8 +223,8 @@ __memset_cc_by4 (void *__s, int __c, size_t __n)
 __STRING_INLINE void *
 __memset_cc_by2 (void *__s, int __c, size_t __n)
 {
+  register unsigned long int __d0;
   register void *__tmp = __s;
-  register int __dummy;
   __asm__ __volatile__
     ("shrl	$1,%1\n\t"	/* may be divisible also by 4 */
      "jz	2f\n"
@@ -232,7 +235,7 @@ __memset_cc_by2 (void *__s, int __c, size_t __n)
      "jnz	1b\n"
      "2:\n\t"
      "movw	%w2,(%0)"
-     : "=r" (__tmp), "=r" (__dummy)
+     : "=&r" (__tmp), "=&r" (__dummy)
      : "q" (0x01010101UL * (unsigned char) __c), "0" (__tmp), "1" (__n / 2)
      : "memory", "cc");
   return __s;
@@ -242,7 +245,7 @@ __STRING_INLINE void *
 __memset_gc_by4 (void *__s, int __c, size_t __n)
 {
   register void *__tmp = __s;
-  register int __dummy;
+  register unsigned long int __d0;
   __asm__ __volatile__
     ("movb	%b0,%h0\n"
      "pushw	%w0\n\t"
@@ -253,7 +256,7 @@ __memset_gc_by4 (void *__s, int __c, size_t __n)
      "addl	$4,%1\n\t"
      "decl	%2\n\t"
      "jnz	1b\n"
-     : "=q" (__c), "=r" (__tmp), "=r" (__dummy)
+     : "=&q" (__c), "=&r" (__tmp), "=&r" (__d0)
      : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
      : "memory", "cc");
   return __s;
@@ -262,8 +265,8 @@ __memset_gc_by4 (void *__s, int __c, size_t __n)
 __STRING_INLINE void *
 __memset_gc_by2 (void *__s, int __c, size_t __n)
 {
+  register unsigned long int __d0, __d1;
   register void *__tmp = __s;
-  register int __dummy1, __dummy2;
   __asm__ __volatile__
     ("movb	%b0,%h0\n\t"
      "shrl	$1,%2\n\t"	/* may be divisible also by 4 */
@@ -278,7 +281,7 @@ __memset_gc_by2 (void *__s, int __c, size_t __n)
      "jnz	1b\n"
      "2:\n\t"
      "movw	%w0,(%1)"
-     : "=q" (__dummy1), "=r" (__tmp), "=r" (__dummy2)
+     : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1)
      : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 2)
      : "memory", "cc");
   return __s;
@@ -287,6 +290,7 @@ __memset_gc_by2 (void *__s, int __c, size_t __n)
 __STRING_INLINE void *
 __memset_cg (void *__s, int __c, size_t __n)
 {
+  register unsigned long __d0, __d1;
   register void *__tmp = __s;
   __asm__ __volatile__
     ("shrl	$1,%%ecx\n\t"
@@ -294,15 +298,16 @@ __memset_cg (void *__s, int __c, size_t __n)
      "jnc	1f\n\t"
      "movb	%%al,(%%edi)\n"
      "1:"
-     : /* no output */
-     : "c" (__n),"D" (__tmp), "a" (0x0101U * (unsigned char) __c)
-     : "cx", "di", "memory", "cc");
+     : "=&c" (__d0), "=&D" (__d1)
+     : "0" (__n), "1" (__tmp), "a" (0x0101U * (unsigned char) __c)
+     : "memory", "cc");
   return __s;
 }
 
 __STRING_INLINE void *
 __memset_gg (void *__s, int __c, size_t __n)
 {
+  register unsigned long int __d0, __d1;
   register void *__tmp = __s;
   __asm__ __volatile__
     ("movb	%%al,%%ah\n\t"
@@ -311,9 +316,9 @@ __memset_gg (void *__s, int __c, size_t __n)
      "jnc	1f\n\t"
      "movb	%%al,(%%edi)\n"
      "1:"
-     : /* no output */
-     : "c" (__n), "D" (__tmp), "a" (__c)
-     : "cx", "di", "memory", "cc");
+     : "=&c" (__d0), "=&D" (__d1)
+     : "0" (__n), "1" (__tmp), "a" (__c)
+     : "memory", "cc");
   return __s;
 }
 
@@ -323,20 +328,31 @@ __memset_gg (void *__s, int __c, size_t __n)
 __STRING_INLINE void *
 memchr (__const void *__s, int __c, size_t __n)
 {
+  register unsigned long int __d0;
   register void *__res;
   if (__n == 0)
     return NULL;
+#ifdef __i686__
+  __asm__ __volatile__
+    ("movl $1, %%edx\n\t"
+     "cld\n\t"
+     "repne; scasb\n\t"
+     "cmovne %%edx,%0"
+     : "=D" (__res), "=&c" (__d0)
+     : "a" (__c), "0" (__s), "1" (__n)
+     : "dx", "cc");
+#else
   __asm__ __volatile__
     ("cld\n\t"
      "repne; scasb\n\t"
      "je	1f\n\t"
      "movl	$1,%0\n"
-     "1:\n\t"
-     "decl	%0"
-     : "=D" (__res)
-     : "a" (__c), "D" (__s), "c" (__n)
-     : "cx", "cc");
-  return __res;
+     "1:"
+     : "=D" (__res), "=&c" (__d0)
+     : "a" (__c), "0" (__s), "1" (__n)
+     : "cc");
+#endif
+  return __res - 1;
 }
 
 
@@ -357,7 +373,7 @@ __strlen_g (__const char *__str)
      "leal	1(%0),%0\n\t"
      "testb	%b1,%b1\n\t"
      "jne	1b"
-     : "=r" (__tmp), "=q" (__dummy)
+     : "=r" (__tmp), "=&q" (__dummy)
      : "0" (__str)
      : "memory", "cc" );
   return __tmp - __str - 1;
@@ -434,7 +450,7 @@ __strcpy_g (char *__dest, __const char *__src)
      "leal	1(%1),%1\n\t"
      "testb	%b2,%b2\n\t"
      "jne	1b"
-     : "=r" (__src), "=r" (__tmp), "=q" (__dummy)
+     : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy)
      : "0" (__src), "1" (__tmp)
      : "memory", "cc");
   return __dest;
@@ -516,7 +532,7 @@ __STRING_INLINE char *
 __mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen)
 {
   register char *__tmp = __dest;
-  register int __dummy1, __dummy2;
+  register unsigned long int __d0, __d1;
   __asm__ __volatile__
     ("1:\n\t"
      "movl	(%2),%0\n\t"
@@ -525,7 +541,7 @@ __mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen)
      "leal	4(%1),%1\n\t"
      "decl	%3\n\t"
      "jnz	1b"
-     : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1)
      : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
      : "memory", "cc");
   return __tmp;
@@ -535,7 +551,7 @@ __STRING_INLINE char *
 __mempcpy_by2 (char *__dest, __const char *__src, size_t __srclen)
 {
   register char *__tmp = __dest;
-  register int __dummy1, __dummy2;
+  register unsigned long int __d0, __d1;
   __asm__ __volatile__
     ("shrl	$1,%3\n\t"
      "jz	2f\n"                 /* only a word */
@@ -549,7 +565,7 @@ __mempcpy_by2 (char *__dest, __const char *__src, size_t __srclen)
      "2:\n\t"
      "movw	(%2),%w0\n\t"
      "movw	%w0,(%1)"
-     : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&q" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1)
      : "1" (__tmp), "2" (__src), "3" (__srclen / 2)
      : "memory", "cc");
   return __tmp + 2;
@@ -558,6 +574,7 @@ __mempcpy_by2 (char *__dest, __const char *__src, size_t __srclen)
 __STRING_INLINE char *
 __mempcpy_byn (char *__dest, __const char *__src, size_t __srclen)
 {
+  register unsigned long __d0, __d1;
   register char *__tmp = __dest;
   __asm__ __volatile__
     ("cld\n\t"
@@ -570,9 +587,9 @@ __mempcpy_byn (char *__dest, __const char *__src, size_t __srclen)
      "movsw\n"
      "2:\n\t"
      "rep; movsl"
-     : "=D" (__tmp)
-     : "c" (__srclen), "0" (__tmp),"S" (__src)
-     : "cx", "di", "si", "memory", "cc");
+     : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1)
+     : "0" (__tmp), "1" (__srclen), "2" (__src)
+     : "memory", "cc");
   return __tmp;
 }
 
@@ -590,7 +607,7 @@ __stpcpy_g (char *__dest, __const char *__src)
      "leal	1(%1),%1\n\t"
      "testb	%b2,%b2\n\t"
      "jne	1b"
-     : "=r" (__src), "=r" (__tmp), "=q" (__dummy)
+     : "=&r" (__src), "=r" (__tmp), "=&q" (__dummy)
      : "0" (__src), "1" (__tmp)
      : "memory", "cc");
   return __tmp - 1;
@@ -626,7 +643,7 @@ __strncpy_by4 (char *__dest, __const char __src[], size_t __srclen, size_t __n)
      "leal	4(%1),%1\n\t"
      "decl	%3\n\t"
      "jnz	1b"
-     : "=r" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&r" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2)
      : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
      : "memory", "cc");
   (void) memset (__tmp, '\0', __n - __srclen);
@@ -651,7 +668,7 @@ __strncpy_by2 (char *__dest, __const char __src[], size_t __srclen, size_t __n)
      "2:\n\t"
      "movw	(%2),%w0\n\t"
      "movw	%w0,(%1)\n\t"
-     : "=q" (__dummy1), "=r" (__tmp), "=r" (__src), "=r" (__dummy2)
+     : "=&q" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2)
      : "1" (__tmp), "2" (__src), "3" (__srclen / 2)
      : "memory", "cc");
   (void) memset (__tmp + 2, '\0', __n - __srclen);
@@ -661,21 +678,22 @@ __strncpy_by2 (char *__dest, __const char __src[], size_t __srclen, size_t __n)
 __STRING_INLINE char *
 __strncpy_byn (char *__dest, __const char __src[], size_t __srclen, size_t __n)
 {
+  register unsigned long int __d0, __d1;
   register char *__tmp = __dest;
   __asm__ __volatile__
     ("cld\n\t"
-     "shrl	$1,%%ecx\n\t"
+     "shrl	$1,%1\n\t"
      "jnc	1f\n\t"
      "movsb\n"
      "1:\n\t"
-     "shrl	$1,%%ecx\n\t"
+     "shrl	$1,%1\n\t"
      "jnc	2f\n\t"
      "movsw\n"
      "2:\n\t"
      "rep; movsl"
-     : "=D" (__tmp)
-     : "c" (__srclen), "0" (__tmp),"S" (__src)
-     : "cx", "di", "si", "memory", "cc");
+     : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1)
+     : "1" (__srclen), "0" (__tmp),"2" (__src)
+     : "memory", "cc");
   (void) memset (__tmp, '\0', __n - __srclen);
   return __dest;
 }
@@ -702,7 +720,7 @@ __strncpy_gg (char *__dest, __const char *__src, size_t __n)
        "decl	%3\n\t"
        "jne	2b\n\t"
        "3:"
-       : "=r" (__src), "=r" (__tmp), "=q" (__dummy), "=r" (__n)
+       : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=&r" (__n)
        : "0" (__src), "1" (__tmp), "3" (__n)
        : "memory", "cc");
 
@@ -720,6 +738,15 @@ __strncpy_gg (char *__dest, __const char *__src, size_t __n)
 __STRING_INLINE char *
 __strcat_c (char *__dest, __const char __src[], size_t __srclen)
 {
+#ifdef __i686__
+  register unsigned long int __d0;
+  register char *__tmp;
+  __asm__ __volatile__
+    ("repne; cmpsb"
+     : "=S" (__tmp), "=&c" (__d0)
+     : "0" (__dest), "1" (0xffffffff), "a" (0)
+     : "cc");
+#else
   register char *__tmp = __dest - 1;
   __asm__ __volatile__
     ("1:\n\t"
@@ -729,6 +756,7 @@ __strcat_c (char *__dest, __const char __src[], size_t __srclen)
      : "=r" (__tmp)
      : "0" (__tmp)
      : "cc");
+#endif
   (void) memcpy (__tmp, __src, __srclen);
   return __dest;
 }
@@ -750,7 +778,7 @@ __strcat_g (char *__dest, __const char *__src)
      "incl	%1\n\t"
      "testb	%b0,%b0\n\t"
      "jne	2b\n"
-     : "=q" (__dummy), "=r" (__tmp), "=r" (__src)
+     : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src)
      : "1"  (__tmp), "2"  (__src)
      : "memory", "cc");
   return __dest;
@@ -789,7 +817,7 @@ __strncat_g (char *__dest, __const char __src[], size_t __n)
      "decl	%1\n"
      "3:\n\t"
      "movb	$0,(%1)\n\t"
-     : "=q" (__dummy), "=r" (__tmp), "=r" (__src), "=r" (__n)
+     : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n)
      : "1" (__tmp), "2" (__src), "3" (__n)
      : "memory", "cc");
   return __dest;
@@ -884,7 +912,7 @@ __strcmp_gg (__const char *__s1, __const char *__s2)
      "jb	3f\n\t"
      "negl	%0\n"
      "3:"
-     : "=q" (__res), "=r" (__s1), "=r" (__s2)
+     : "=q" (__res), "=&r" (__s1), "=&r" (__s2)
      : "1" (__s1), "2" (__s2)
      : "cc");
   return __res;
@@ -923,7 +951,7 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n)
      "jb	4f\n\t"
      "negl	%0\n"
      "4:"
-     : "=q" (__res), "=r" (__s1), "=r" (__s2), "=r" (__n)
+     : "=q" (__res), "=&r" (__s1), "=&r" (__s2), "=&r" (__n)
      : "1"  (__s1), "2"  (__s2),  "3" (__n)
      : "cc");
   return __res;
@@ -940,6 +968,7 @@ __strncmp_g (__const char *__s1, __const char *__s2, size_t __n)
 __STRING_INLINE char *
 __strchr_c (__const char *__s, int __c)
 {
+  register unsigned long int __d0;
   register char *__res;
   __asm__ __volatile__
     ("1:\n\t"
@@ -951,15 +980,16 @@ __strchr_c (__const char *__s, int __c)
      "jne	1b\n\t"
      "xorl	%0,%0\n"
      "2:"
-     : "=r" (__res)
-     : "a" (__c), "0" (__s)
-     : "ax", "cc");
+     : "=r" (__res), "=&a" (__d0)
+     : "0" (__s), "1" (__c)
+     : "cc");
   return __res;
 }
 
 __STRING_INLINE char *
 __strchr_g (__const char *__s, int __c)
 {
+  register unsigned long int __d0;
   register char *__res;
   __asm__ __volatile__
     ("movb	%%al,%%ah\n"
@@ -972,9 +1002,9 @@ __strchr_g (__const char *__s, int __c)
      "jne	1b\n\t"
      "xorl	%0,%0\n"
      "2:"
-     : "=r" (__res)
-     : "a" (__c), "0" (__s)
-     : "ax", "cc");
+     : "=r" (__res), "=&a" (__d0)
+     : "0" (__s), "1" (__c)
+     : "cc");
   return __res;
 }
 
@@ -1000,43 +1030,46 @@ __strchr_g (__const char *__s, int __c)
 __STRING_INLINE char *
 __strrchr_c (__const char *__s, int __c)
 {
+  register unsigned long int __d0, __d1;
   register char *__res;
   __asm__ __volatile__
     ("cld\n"
      "1:\n\t"
      "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "cmove	%%esi,%0\n\t"
-     "testb	%%al,%%al\n\t"
+     "cmpb	%h2,%b2\n\t"
+     "cmove	%1,%0\n\t"
+     "testb	%b2,%b2\n\t"
      "jne 1b"
-     : "=d" (__res)
-     : "0" (1), "S" (__s), "a" (__c)
-     : "ax", "si", "cc");
+     : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+     : "0" (1), "1" (__s), "2" (__c)
+     : "cc");
   return __res - 1;
 }
 
 __STRING_INLINE char *
 __strrchr_g (__const char *__s, int __c)
 {
+  register unsigned long int __d0, __d1;
   register char *__res;
   __asm__ __volatile__
-    ("movb	%%al,%%ah\n"
+    ("movb	%b2,%h2\n"
      "cld\n\t"
      "1:\n\t"
      "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "cmove	%%esi,%0\n\t"
-     "testb	%%al,%%al\n\t"
+     "cmpb	%h2,%b2\n\t"
+     "cmove	%1,%0\n\t"
+     "testb	%b2,%b2\n\t"
      "jne 1b"
-     : "=r" (__res)
-     : "0" (1), "S" (__s), "a" (__c)
-     : "ax", "si", "cc");
+     : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+     : "0" (1), "1" (__s), "2" (__c)
+     : "cc");
   return __res - 1;
 }
 #else
 __STRING_INLINE char *
 __strrchr_c (__const char *__s, int __c)
 {
+  register unsigned long int __d0, __d1;
   register char *__res;
   __asm__ __volatile__
     ("cld\n"
@@ -1048,15 +1081,16 @@ __strrchr_c (__const char *__s, int __c)
      "2:\n\t"
      "testb	%%al,%%al\n\t"
      "jne 1b"
-     : "=d" (__res)
-     : "0" (0), "S" (__s),"a" (__c)
-     : "ax", "si", "cc");
+     : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+     : "0" (0), "1" (__s), "2" (__c)
+     : "cc");
   return __res;
 }
 
 __STRING_INLINE char *
 __strrchr_g (__const char *__s, int __c)
 {
+  register unsigned long int __d0, __d1;
   register char *__res;
   __asm__ __volatile__
     ("movb	%%al,%%ah\n"
@@ -1069,9 +1103,9 @@ __strrchr_g (__const char *__s, int __c)
      "2:\n\t"
      "testb	%%al,%%al\n\t"
      "jne 1b"
-     : "=r" (__res)
-     : "0" (0), "S" (__s),"a" (__c)
-     : "ax", "si", "cc");
+     : "=r" (__res), "=&S" (__d0), "=&a" (__d1)
+     : "0" (0), "1" (__s), "2" (__c)
+     : "cc");
   return __res;
 }
 #endif
@@ -1102,6 +1136,7 @@ __strrchr_g (__const char *__s, int __c)
 __STRING_INLINE size_t
 __strcspn_c1 (__const char *__s, int __reject)
 {
+  register unsigned long int __d0;
   register char *__res;
   __asm__ __volatile__
     ("1:\n\t"
@@ -1112,15 +1147,16 @@ __strcspn_c1 (__const char *__s, int __reject)
      "testb	%%al,%%al\n\t"
      "jne	1b\n"
      "2:"
-     : "=r" (__res)
-     : "a" (__reject), "0" (__s)
-     : "ax", "cc");
+     : "=r" (__res), "=&a" (__d0)
+     : "0" (__s), "1" (__reject)
+     : "cc");
   return (__res - 1) - __s;
 }
 
 __STRING_INLINE size_t
 __strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
 {
+  register unsigned long int __d0, __d1, __d2;
   register __const char *__res;
   __asm__ __volatile__
     ("cld\n"
@@ -1128,14 +1164,14 @@ __strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%2,%%edi\n\t"
-     "movl	%3,%%ecx\n\t"
+     "movl	%5,%%edi\n\t"
+     "movl	%6,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n"
      "2:"
-     : "=S" (__res)
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
      : "0" (__s), "d" (__reject), "g" (__reject_len)
-     : "ax", "cx", "di", "cc");
+     : "cc");
   return (__res - 1) - __s;
 }
 
@@ -1143,11 +1179,12 @@ __strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
 __STRING_INLINE size_t
 __strcspn_g (__const char *__s, __const char *__reject)
 {
+  register unsigned long int __d0, __d1, __d2;
   register __const char *__res;
   int __mem;
   __asm__ __volatile__
-    ("movl	%%ebx,%1\n\t"
-     "movl	%5,%%edi\n\t"
+    ("pushl	%%ebx\n\t"
+     "movl	%4,%%edi\n\t"
      "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
@@ -1156,21 +1193,22 @@ __strcspn_g (__const char *__s, __const char *__reject)
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%5,%%edi\n\t"
+     "movl	%4,%%edi\n\t"
      "movl	%%ebx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n"
      "2:\n\t"
-     "movl	%1,%%ebx"
-     : "=S" (__res), "=&m" (__mem)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "r" (__reject), "1" (__mem)
-     : "ax", "cx", "di", "cc");
+     "popl	%%ebx"
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+     : "r" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)
+     : "cc");
   return (__res - 1) - __s;
 }
 #else
 __STRING_INLINE size_t
 __strcspn_g (__const char *__s, __const char *__reject)
 {
+  register unsigned long int __d0, __d1, __d2, __d3;
   register __const char *__res;
   __asm__ __volatile__
     ("cld\n\t"
@@ -1186,9 +1224,9 @@ __strcspn_g (__const char *__s, __const char *__reject)
      "repne; scasb\n\t"
      "jne	1b\n"
      "2:"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__reject), "D" (__reject)
-     : "ax", "cx", "dx", "di", "cc");
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
+     : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__reject), "b" (__reject)
+     : "cc");
   return (__res - 1) - __s;
 }
 #endif
@@ -1209,23 +1247,25 @@ __strcspn_g (__const char *__s, __const char *__reject)
 __STRING_INLINE size_t
 __strspn_c1 (__const char *__s, int __accept)
 {
+  register unsigned long int __d0;
   register char *__res;
   /* Please note that __accept never can be '\0'.  */
   __asm__ __volatile__
     ("1:\n\t"
-     "movb	(%0),%%al\n\t"
+     "movb	(%0),%b1\n\t"
      "leal	1(%0),%0\n\t"
-     "cmpb	%%ah,%%al\n\t"
+     "cmpb	%h1,%b1\n\t"
      "je	1b"
-     : "=r" (__res)
-     : "a" (__accept), "0" (__s)
-     : "ax", "cc");
+     : "=r" (__res), "=&q" (__d0)
+     : "0" (__s), "1" (__accept)
+     : "cc");
   return (__res - 1) - __s;
 }
 
 __STRING_INLINE size_t
 __strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 {
+  register unsigned long int __d0, __d1, __d2;
   register __const char *__res;
   __asm__ __volatile__
     ("cld\n"
@@ -1233,14 +1273,14 @@ __strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%2,%%edi\n\t"
-     "movl	%3,%%ecx\n\t"
+     "movl	%1,%%edi\n\t"
+     "movl	%6,%%ecx\n\t"
      "repne; scasb\n\t"
      "je	1b\n"
      "2:"
-     : "=S" (__res)
-     : "0" (__s), "d" (__accept), "g" (__accept_len)
-     : "ax", "cx", "di", "cc");
+     : "=S" (__res), "=&d" (__d0), "=&c" (__d1), "=&D" (__d2)
+     : "0" (__s), "1" (__accept), "g" (__accept_len)
+     : "cc");
   return (__res - 1) - __s;
 }
 
@@ -1248,10 +1288,11 @@ __strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 __STRING_INLINE size_t
 __strspn_g (__const char *__s, __const char *__accept)
 {
+  register unsigned long int __d0, __d1, __d2;
   register __const char *__res;
   int __mem;
   __asm__ __volatile__
-    ("movl	%%ebx,%1\n\t"
+    ("pushl	%%ebx\n\t"
      "cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
@@ -1265,17 +1306,17 @@ __strspn_g (__const char *__s, __const char *__accept)
      "repne; scasb\n\t"
      "je	1b\n"
      "2:\n\t"
-     "movl	%1,%%ebx"
-     : "=S" (__res), "=m" (__mem)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "d" (__accept), "1" (__mem),
-       "D" (__accept)
-     : "ax", "cx", "di", "cc");
+     "popl	%%ebx"
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+     : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept)
+     : "cc");
   return (__res - 1) - __s;
 }
 #else
 __STRING_INLINE size_t
 __strspn_g (__const char *__s, __const char *__accept)
 {
+  register unsigned long int __d0, __d1, __d2, __d3;
   register __const char *__res;
   __asm__ __volatile__
     ("cld\n\t"
@@ -1291,9 +1332,9 @@ __strspn_g (__const char *__s, __const char *__accept)
      "repne; scasb\n\t"
      "je	1b\n"
      "2:"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__accept), "D" (__accept)
-     : "ax", "cx", "dx", "di", "cc");
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
+     : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept), "b" (__accept)
+     : "cc");
   return (__res - 1) - __s;
 }
 #endif
@@ -1313,6 +1354,7 @@ __strspn_g (__const char *__s, __const char *__accept)
 __STRING_INLINE char *
 __strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 {
+  register unsigned long int __d0, __d1, __d2;
   register char *__res;
   __asm__ __volatile__
     ("cld\n"
@@ -1320,8 +1362,8 @@ __strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%2,%%edi\n\t"
-     "movl	%3,%%ecx\n\t"
+     "movl	%5,%%edi\n\t"
+     "movl	%6,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n\t"
      "decl	%0\n\t"
@@ -1329,9 +1371,9 @@ __strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
      "2:\n\t"
      "xorl	%0,%0\n"
      "3:"
-     : "=S" (__res)
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
      : "0" (__s), "d" (__accept), "g" (__accept_len)
-     : "ax", "cx", "di", "cc");
+     : "cc");
   return __res;
 }
 
@@ -1339,10 +1381,11 @@ __strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
 __STRING_INLINE char *
 __strpbrk_g (__const char *__s, __const char *__accept)
 {
+  register unsigned long int __d0, __d1, __d2;
   register char *__res;
   int __mem;
   __asm__ __volatile__
-    ("movl	%%ebx,%1\n\t"
+    ("pushl	%%ebx\n\t"
      "movl	%%edx,%%edi\n\t"
      "cld\n\t"
      "repne; scasb\n\t"
@@ -1361,16 +1404,17 @@ __strpbrk_g (__const char *__s, __const char *__accept)
      "2:\n\t"
      "xorl	%0,%0\n"
      "3:\n\t"
-     "movl	%1,%%ebx"
-     : "=S" (__res), "=m" (__mem)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "d" (__accept), "1" (__mem)
-     : "ax", "cx", "di", "cc");
+     "popl	%%ebx"
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+     : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)
+     : "cc");
   return __res;
 }
 #else
 __STRING_INLINE char *
 __strpbrk_g (__const char *__s, __const char *__accept)
 {
+  register unsigned long int __d0, __d1, __d2, __d3;
   register char *__res;
   __asm__ __volatile__
     ("movl	%%ebx,%%edi\n\t"
@@ -1391,9 +1435,9 @@ __strpbrk_g (__const char *__s, __const char *__accept)
      "2:\n\t"
      "xorl	%0,%0\n"
      "3:"
-     : "=S" (__res)
-     : "a" (0), "c" (0xffffffff), "0" (__s), "b" (__accept)
-     : "ax", "cx", "dx", "di", "cc");
+     : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
+     : "0" (__s), "1" (0), "2" (0xffffffff), "b" (__accept)
+     : "cc");
   return __res;
 }
 #endif
@@ -1416,42 +1460,39 @@ __STRING_INLINE char *
 __strstr_cg (__const char *__haystack, __const char __needle[],
 	     size_t __needle_len)
 {
+  register unsigned long int __d0, __d1, __d2;
   register char *__res;
   __asm__ __volatile__
     ("cld\n" \
      "1:\n\t"
-     "movl	%3,%%edi\n\t"
-     "movl	%2,%%eax\n\t"
-     "movl	%1,%%ecx\n\t"
+     "movl	%6,%%edi\n\t"
+     "movl	%5,%%eax\n\t"
+     "movl	%4,%%ecx\n\t"
      "repe; cmpsb\n\t"
      "je	2f\n\t"
      "cmpb	$0,-1(%%esi)\n\t"
-     "leal	1(%%eax),%2\n\t"
+     "leal	1(%%eax),%5\n\t"
      "jne	1b\n\t"
      "xorl	%%eax,%%eax\n"
      "2:"
-     : "=a" (__res)
-     : "g" (__needle_len), "S" (__haystack), "d" (__needle)
-     : "cx", "di", "si", "cc");
+     : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
+     : "g" (__needle_len), "1" (__haystack), "d" (__needle)
+     : "cc");
   return __res;
 }
 
 #ifdef __PIC__
-# if 1
-/* For now this does not always works due to spilling problems.  */
-#  define __strstr_g(haystack, needle) strstr (haystack, needle)
-# else
 __STRING_INLINE char *
 __strstr_g (__const char *__haystack, __const char *__needle)
 {
+  register unsigned long int __d0, __d1, __d2;
   register char *__res;
   int __mem;
   __asm__ __volatile__
-    ("movl	%2,%%edi\n\t"
-     "cld\n\t"
+    ("cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
-     "movl	%%ebx,%1\n\t"
+     "pushl	%%ebx\n\t"
      "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
      "movl	%%ecx,%%ebx\n"
      "1:\n\t"
@@ -1465,21 +1506,19 @@ __strstr_g (__const char *__haystack, __const char *__needle)
      "jne	1b\n\t"
      "xorl	%%eax,%%eax\n"
      "2:\n\t"
-     "movl	%1,%%ebx"
-     : "=a" (__res), "=&m" (__mem)
-     : "0" (0), "c" (0xffffffff), "S" (__haystack), "d" (__needle), "1" (__mem)
-     : "cx", "di", "si", "cc");
+     "popl	%%ebx"
+     : "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
+     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "d" (__needle)
+     : "cc");
   return __res;
 }
-# endif
 #else
 __STRING_INLINE char *
 __strstr_g (__const char *__haystack, __const char *__needle)
 {
   register char *__res;
   __asm__ __volatile__
-    ("movl	%1,%%edi\n\t"
-     "cld\n\t"
+    ("cld\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
      "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
@@ -1495,9 +1534,9 @@ __strstr_g (__const char *__haystack, __const char *__needle)
      "jne	1b\n\t"
      "xorl	%%eax,%%eax\n"
      "2:"
-     : "=a" (__res)
-     : "0" (0), "c" (0xffffffff), "S" (__haystack), "b" (__needle)
-     : "cx", "dx", "di", "si", "cc");
+     : "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3)
+     : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "b" (__needle)
+     : "cc");
   return __res;
 }
 #endif