1999-02-20  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dynamic-link.h (elf_get_dynamic_info): Use memset instead of
	loop to clear `info'.

	* sysdeps/i386/i486/bits/string.h: If fill byte is constant let gcc
	do the work and don't use inline assembler.
This commit is contained in:
Ulrich Drepper 1999-02-20 09:40:26 +00:00
parent 126b06f99e
commit 57846308af
3 changed files with 12 additions and 77 deletions

View File

@ -1,3 +1,11 @@
1999-02-20 Ulrich Drepper <drepper@cygnus.com>
* elf/dynamic-link.h (elf_get_dynamic_info): Use memset instead of
loop to clear `info'.
* sysdeps/i386/i486/bits/string.h: If fill byte is constant let gcc
do the work and don't use inline assembler.
1999-02-19 Ulrich Drepper <drepper@cygnus.com>
* elf/ldsodefs.h (_dl_signal_error): Mark as __noreturn__.

View File

@ -1,5 +1,5 @@
/* Inline functions for dynamic linking.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -34,10 +34,8 @@ elf_get_dynamic_info (ElfW(Dyn) *dyn,
ElfW(Dyn) *info[DT_NUM + DT_PROCNUM + DT_VERSIONTAGNUM
+ DT_EXTRANUM])
{
unsigned int i;
for (i = 0; i < DT_NUM + DT_PROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM; ++i)
info[i] = NULL;
memset (info, '\0', ((DT_NUM + DT_PROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM)
* sizeof (ElfW(Dyn) *)));
if (! dyn)
return;

View File

@ -190,20 +190,10 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
#define _HAVE_STRING_ARCH_memset 1
#define memset(s, c, n) \
(__extension__ (__builtin_constant_p (c) \
? (__builtin_constant_p (n) \
? __memset_cc (s, c, n) \
: __memset_cg (s, c, n)) \
? memset (s, c, n) \
: (__builtin_constant_p (n) \
? __memset_gc (s, c, n) \
: __memset_gg (s, c, n))))
#define __memset_cc(s, c, n) \
((n) == 0 \
? (s) \
: (((n) % 4 == 0) \
? __memset_cc_by4 (s, c, n) \
: (((n) % 2== 0) \
? __memset_cc_by2 (s, c, n) \
: __memset_cg (s, c, n))))
#define __memset_gc(s, c, n) \
((n) == 0 \
? (s) \
@ -213,48 +203,6 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n)
? __memset_gc_by2 (s, c, n) \
: __memset_gg (s, c, n))))
__STRING_INLINE void *__memset_cc_by4 (void *__s, int __c, 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;
__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" (__d0)
: "q" (0x01010101UL * (unsigned char) __c), "0" (__tmp), "1" (__n / 4)
: "memory", "cc");
return __s;
}
__STRING_INLINE void *__memset_cc_by2 (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;
__asm__ __volatile__
("shrl $1,%1\n\t" /* may be divisible also by 4 */
"jz 2f\n"
"1:\n\t"
"movl %2,(%0)\n\t"
"leal 4(%0),%0\n\t"
"decl %1\n\t"
"jnz 1b\n"
"2:\n\t"
"movw %w2,(%0)"
: "=&r" (__tmp), "=&r" (__d0)
: "q" (0x01010101UL * (unsigned char) __c), "0" (__tmp), "1" (__n / 2)
: "memory", "cc");
return __s;
}
__STRING_INLINE void *__memset_gc_by4 (void *__s, int __c, size_t __n);
__STRING_INLINE void *
@ -305,25 +253,6 @@ __memset_gc_by2 (void *__s, int __c, size_t __n)
return __s;
}
__STRING_INLINE void *__memset_cg (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"
"rep; stosw\n\t"
"jnc 1f\n\t"
"movb %%al,(%%edi)\n"
"1:"
: "=&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);
__STRING_INLINE void *