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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [i386/] [memset.S] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jlechner
/*
2
 * ====================================================
3
 * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
4
 *
5
 * Permission to use, copy, modify, and distribute this
6
 * software is freely granted, provided that this notice
7
 * is preserved.
8
 * ====================================================
9
 */
10
 
11
        #include "i386mach.h"
12
 
13
        .global SYM (memset)
14
       SOTYPE_FUNCTION(memset)
15
 
16
SYM (memset):
17
 
18
        pushl ebp
19
        movl esp,ebp
20
        pushl edi
21
        movl 8(ebp),edi
22
        movzbl 12(ebp),eax
23
        movl 16(ebp),ecx
24
        cld
25
 
26
#ifndef __OPTIMIZE_SIZE__
27
/* Less than 16 bytes won't benefit from the 'rep stosl' loop.  */
28
        cmpl $16,ecx
29
        jbe .L19
30
        testl $7,edi
31
        je .L10
32
 
33
/* It turns out that 8-byte aligned 'rep stosl' outperforms
34
   4-byte aligned on some x86 platforms.  */
35
        movb al,(edi)
36
        incl edi
37
        decl ecx
38
        testl $7,edi
39
        je .L10
40
 
41
        movb al,(edi)
42
        incl edi
43
        decl ecx
44
        testl $7,edi
45
        je .L10
46
 
47
        movb al,(edi)
48
        incl edi
49
        decl ecx
50
        testl $7,edi
51
        je .L10
52
 
53
        movb al,(edi)
54
        incl edi
55
        decl ecx
56
        testl $7,edi
57
        je .L10
58
 
59
        movb al,(edi)
60
        incl edi
61
        decl ecx
62
        testl $7,edi
63
        je .L10
64
 
65
        movb al,(edi)
66
        incl edi
67
        decl ecx
68
        testl $7,edi
69
        je .L10
70
 
71
        movb al,(edi)
72
        incl edi
73
        decl ecx
74
 
75
/* At this point, ecx>8 and edi%8==0.  */
76
.L10:
77
        movb al,ah
78
        movl eax,edx
79
        sall $16,edx
80
        orl edx,eax
81
 
82
        movl ecx,edx
83
        shrl $2,ecx
84
        andl $3,edx
85
        rep
86
        stosl
87
        movl edx,ecx
88
#endif /* not __OPTIMIZE_SIZE__ */
89
 
90
.L19:
91
        rep
92
        stosb
93
 
94
        movl 8(ebp),eax
95
 
96
        leal -4(ebp),esp
97
        popl edi
98
        leave
99
        ret

powered by: WebSVN 2.1.0

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