OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [machine/] [i386/] [memcmp.S] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
        #include "i386mach.h"
        #include "i386mach.h"
        .global SYM (memcmp)
        .global SYM (memcmp)
       SOTYPE_FUNCTION(memcmp)
       SOTYPE_FUNCTION(memcmp)
SYM (memcmp):
SYM (memcmp):
        pushl ebp
        pushl ebp
        movl esp,ebp
        movl esp,ebp
        subl $16,esp
        subl $16,esp
        pushl ebx
        pushl ebx
        pushl edi
        pushl edi
        pushl esi
        pushl esi
        movl 8(ebp),edi
        movl 8(ebp),edi
        movl 12(ebp),esi
        movl 12(ebp),esi
        movl 16(ebp),ecx
        movl 16(ebp),ecx
        cld
        cld
/* check if length is zero in which case just return 0 */
/* check if length is zero in which case just return 0 */
        xorl eax,eax
        xorl eax,eax
        testl ecx,ecx
        testl ecx,ecx
        jz L4
        jz L4
#ifndef __OPTIMIZE_SIZE__
#ifndef __OPTIMIZE_SIZE__
/* if aligned on long boundary, compare doublewords at a time first */
/* if aligned on long boundary, compare doublewords at a time first */
        movl edi,eax
        movl edi,eax
        orl esi,eax
        orl esi,eax
        testb $3,al
        testb $3,al
        jne BYTECMP
        jne BYTECMP
        movl ecx,ebx
        movl ecx,ebx
        shrl $2,ecx             /* calculate number of long words to compare */
        shrl $2,ecx             /* calculate number of long words to compare */
        repz
        repz
        cmpsl
        cmpsl
        jz L5
        jz L5
        subl $4,esi
        subl $4,esi
        subl $4,edi
        subl $4,edi
        movl $4,ecx
        movl $4,ecx
        jmp BYTECMP
        jmp BYTECMP
L5:
L5:
        andl $3,ebx             /* calculate number of remaining bytes */
        andl $3,ebx             /* calculate number of remaining bytes */
        movl ebx,ecx
        movl ebx,ecx
#endif /* not __OPTIMIZE_SIZE__ */
#endif /* not __OPTIMIZE_SIZE__ */
BYTECMP: /* compare any unaligned bytes or remainder bytes */
BYTECMP: /* compare any unaligned bytes or remainder bytes */
        repz
        repz
        cmpsb
        cmpsb
/* set output to be < 0 if less than, 0 if equal, or > 0 if greater than */
/* set output to be < 0 if less than, 0 if equal, or > 0 if greater than */
L3:
L3:
        xorl edx,edx
        xorl edx,edx
        movb -1(esi),dl
        movb -1(esi),dl
        xorl eax,eax
        xorl eax,eax
        movb -1(edi),al
        movb -1(edi),al
        subl edx,eax
        subl edx,eax
L4:
L4:
        leal -28(ebp),esp
        leal -28(ebp),esp
        popl esi
        popl esi
        popl edi
        popl edi
        popl ebx
        popl ebx
        leave
        leave
        ret
        ret
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.