This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Optimized string operations for i586...


> 
> On Thu, 8 Apr 1999, H.J. Lu wrote:
> 
> > It seems to work for me. I have to ask how you did the NIS lookup test?
> > It is very tricky. I almost made a mistak. Please make sure you use
> > the shared libraries and dynamic linkers from the same build. Anyway,
> > send me your test. I will take a look.
> 
> Well, you have to actually put together an NIS server and enable NIS on
> the machine, run ypbind, install that glibc on the ssystem, and run 
> "id <someNISuser>" and you get an ugly stack trace.
> 

It seems like a compiler bug. We have

__STRING_INLINE char *
__strncpy_gg (char *__dest, __const char *__src, size_t __n)
{
  register char *__tmp = __dest;
  register char __dummy;
  if (__n > 0)
    __asm__ __volatile__
      ("1:\n\t"
       "movb    (%0),%2\n\t"
       "incl    %0\n\t"
       "movb    %2,(%1)\n\t"
       "incl    %1\n\t"
       "decl    %3\n\t"
       "je      3f\n\t"
       "testb   %2,%2\n\t"
       "jne     1b\n\t"
       "2:\n\t"
       "movb    %2,(%1)\n\t"
       "incl    %1\n\t"
       "decl    %3\n\t"
       "jne     2b\n\t"
       "3:"
       : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=&r" (__n)
       : "0" (__src), "1" (__tmp), "3" (__n)
       : "memory", "cc");

  return __dest;
}

egcs 1.1.2 turns it into

.stabs "../sysdeps/i386/i486/bits/string.h",132,0,0,.Ltext5
.Ltext5:
.stabn 68,0,711,.LM34-internal_nis_getgrent_r
.LM34:
        testl %ecx,%ecx
        je .L524
.stabn 68,0,712,.LM35-internal_nis_getgrent_r
.LM35:
        movl %eax,%esi
        movl 12(%ebp),%ecx 	<<<<<
        movl %ecx,%edi		<<<<<
#APP
        1:
        movb    (%esi),%dl
        incl    %esi    
        movb    %dl,(%ecx)
        incl    %ecx    
        decl    %edi    
        je      3f      
        testb   %dl,%dl
        jne     1b
        2:
        movb    %dl,(%ecx)
        incl    %ecx
        decl    %edi
        jne     2b
        3:
#NO_APP
        movl -8(%ebp),%edx
        movl %edx,-48(%ebp)
.L524:

I believe the lines with "<<<<<" should be swapped. I will see what I
can dig out.


-- 
H.J. Lu (hjl@gnu.org)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]