OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [machine/] [i386/] [memset.S] - Rev 307

Go to most recent revision | Compare with Previous | Blame | View Log

/*
 * ====================================================
 * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

        #include "i386mach.h"

        .global SYM (memset)
       SOTYPE_FUNCTION(memset)

SYM (memset):

        pushl ebp
        movl esp,ebp
        pushl edi
        movl 8(ebp),edi
        movzbl 12(ebp),eax
        movl 16(ebp),ecx
        cld

#ifndef __OPTIMIZE_SIZE__
/* Less than 16 bytes won't benefit from the 'rep stosl' loop.  */
        cmpl $16,ecx
        jbe .L19
        testl $7,edi
        je .L10

/* It turns out that 8-byte aligned 'rep stosl' outperforms
   4-byte aligned on some x86 platforms.  */
        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx
        testl $7,edi
        je .L10

        movb al,(edi)
        incl edi
        decl ecx

/* At this point, ecx>8 and edi%8==0.  */
.L10:
        movb al,ah
        movl eax,edx
        sall $16,edx
        orl edx,eax

        movl ecx,edx
        shrl $2,ecx
        andl $3,edx
        rep
        stosl
        movl edx,ecx
#endif /* not __OPTIMIZE_SIZE__ */

.L19:
        rep
        stosb

        movl 8(ebp),eax

        leal -4(ebp),esp
        popl edi
        leave
        ret

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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