[BACK]Return to strcmp.S CVS log [TXT][DIR] Up to [local] / sys / lib / libkern / arch / amd64

Annotation of sys/lib/libkern/arch/amd64/strcmp.S, Revision 1.1.1.1

1.1       nbrk        1: /*
                      2:  * Written by J.T. Conklin <jtc@netbsd.org>.
                      3:  * Public domain.
                      4:  * Adapted for NetBSD/x86_64 by Frank van der Linden <fvdl@wasabisystems.com>
                      5:  */
                      6:
                      7: #include <machine/asm.h>
                      8:
                      9: #if defined(LIBC_SCCS)
                     10:        RCSID("$NetBSD: strcmp.S,v 1.1 2001/06/19 00:22:47 fvdl Exp $")
                     11: #endif
                     12:
                     13: /*
                     14:  * NOTE: I've unrolled the loop eight times: large enough to make a
                     15:  * significant difference, and small enough not to totally trash the
                     16:  * cache.
                     17:  */
                     18:
                     19: ENTRY(strcmp)
                     20:        jmp     L2                      /* Jump into the loop. */
                     21:
                     22: L1:    incq    %rdi
                     23:        incq    %rsi
                     24: L2:    movb    (%rdi),%cl
                     25:        testb   %cl,%cl                 /* null terminator */
                     26:        jz      L3
                     27:        cmpb    %cl,(%rsi)              /* chars match */
                     28:        jne     L3
                     29:
                     30:        incq    %rdi
                     31:        incq    %rsi
                     32:        movb    (%rdi),%cl
                     33:        testb   %cl,%cl
                     34:        jz      L3
                     35:        cmpb    %cl,(%rsi)
                     36:        jne     L3
                     37:
                     38:        incq    %rdi
                     39:        incq    %rsi
                     40:        movb    (%rdi),%cl
                     41:        testb   %cl,%cl
                     42:        jz      L3
                     43:        cmpb    %cl,(%rsi)
                     44:        jne     L3
                     45:
                     46:        incq    %rdi
                     47:        incq    %rsi
                     48:        movb    (%rdi),%cl
                     49:        testb   %cl,%cl
                     50:        jz      L3
                     51:        cmpb    %cl,(%rsi)
                     52:        jne     L3
                     53:
                     54:        incq    %rdi
                     55:        incq    %rsi
                     56:        movb    (%rdi),%cl
                     57:        testb   %cl,%cl
                     58:        jz      L3
                     59:        cmpb    %cl,(%rsi)
                     60:        jne     L3
                     61:
                     62:        incq    %rdi
                     63:        incq    %rsi
                     64:        movb    (%rdi),%cl
                     65:        testb   %cl,%cl
                     66:        jz      L3
                     67:        cmpb    %cl,(%rsi)
                     68:        jne     L3
                     69:
                     70:        incq    %rdi
                     71:        incq    %rsi
                     72:        movb    (%rdi),%cl
                     73:        testb   %cl,%cl
                     74:        jz      L3
                     75:        cmpb    %cl,(%rsi)
                     76:        jne     L3
                     77:
                     78:        incq    %rdi
                     79:        incq    %rsi
                     80:        movb    (%rdi),%cl
                     81:        testb   %cl,%cl
                     82:        jz      L3
                     83:        cmpb    %cl,(%rsi)
                     84:        je      L1
                     85: L3:    movzbl  (%rdi),%eax             /* unsigned comparison */
                     86:        movzbl  (%rsi),%edx
                     87:        subl    %edx,%eax
                     88:        ret

CVSweb