about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2002-04-14 07:24:12 +0000
committerAndreas Jaeger <aj@suse.de>2002-04-14 07:24:12 +0000
commitb91703dc380870510cb31569642d21d9d9b03eb2 (patch)
tree77732067e11d19bbc7b351039f63f186c9980deb
parent53af71e0fdbe2336bfc7c7fb97f3edf1c6e881d4 (diff)
downloadglibc-b91703dc380870510cb31569642d21d9d9b03eb2.tar.gz
glibc-b91703dc380870510cb31569642d21d9d9b03eb2.tar.xz
glibc-b91703dc380870510cb31569642d21d9d9b03eb2.zip
(__strcspn_cg): Use only memory as clobber to reduce register pressure.
(__strpbrk_cg): Likewise. 
(__mempcpy_by4): Likewise. 
(__strstr_cg): Likewise. 
Add prototype for __memrchr.
-rw-r--r--sysdeps/i386/i486/bits/string.h30
1 files changed, 12 insertions, 18 deletions
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 802bbea1fb..cbb074712a 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -463,6 +463,8 @@ memchr (__const void *__s, int __c, size_t __n)
 
 #define _HAVE_STRING_ARCH_memrchr 1
 #ifndef _FORCE_INLINES
+__STRING_INLINE void *__memrchr (__const void *__s, int __c, size_t __n);
+
 __STRING_INLINE void *
 __memrchr (__const void *__s, int __c, size_t __n)
 {
@@ -729,11 +731,9 @@ __mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen)
      "leal	4(%1),%1\n\t"
      "decl	%3\n\t"
      "jnz	1b"
-     : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1),
-       "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
-     : "1" (__tmp), "2" (__src), "3" (__srclen / 4),
-       "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
-     : "cc");
+     : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1)
+     : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
+     : "memory", "cc");
   return __tmp;
 }
 
@@ -1535,10 +1535,8 @@ __strcspn_cg (__const char *__s, __const char __reject[], size_t __reject_len)
      "jne	1b\n"
      "2:"
      : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "0" (__s), "d" (__reject), "g" (__reject_len),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s),
-       "m" ( *(struct { __extension__ char __x[__reject_len]; } *)__reject)
-     : "cc");
+     : "0" (__s), "d" (__reject), "g" (__reject_len)
+     : "memory", "cc");
   return (__res - 1) - __s;
 }
 
@@ -1657,6 +1655,7 @@ __strspn_cg (__const char *__s, __const char __accept[], size_t __accept_len)
      "2:"
      : "=S" (__res), "=&d" (__d0), "=&c" (__d1), "=&D" (__d2)
      : "0" (__s), "1" (__accept), "g" (__accept_len),
+       /* Since we do not know how large the memory we access it, use a really large amount.  */
        "m" ( *(struct { char __x[0xfffffff]; } *)__s),
        "m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept)
      : "cc");
@@ -1755,10 +1754,8 @@ __strpbrk_cg (__const char *__s, __const char __accept[], size_t __accept_len)
      "xorl	%0,%0\n"
      "3:"
      : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "0" (__s), "d" (__accept), "g" (__accept_len),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s),
-       "m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept)
-     : "cc");
+     : "0" (__s), "d" (__accept), "g" (__accept_len)
+     : "memory", "cc");
   return __res;
 }
 
@@ -1865,11 +1862,8 @@ __strstr_cg (__const char *__haystack, __const char __needle[],
      "xorl	%%eax,%%eax\n"
      "2:"
      : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
-     : "g" (__needle_len), "1" (__haystack), "d" (__needle),
-       /* Since we do not know how large the memory we access it, use a really large amount.  */
-       "m" ( *(struct { char __x[0xfffffff]; } *)__haystack),
-       "m" ( *(struct { __extension__ char __x[__needle_len]; } *)__needle)
-     : "cc");
+     : "g" (__needle_len), "1" (__haystack), "d" (__needle)
+     : "memory", "cc");
   return __res;
 }