libc - Do some reorganization of nmalloc() and add asserts.
[dragonfly.git] / test / sysperf / memzero.S
blobe70923dab70a5b70541fd72fafea1e6272ab1cd2
2                 /*
3                  * memcpy.S
4                  *
5                  * $DragonFly: src/test/sysperf/memzero.S,v 1.1 2004/04/29 16:14:53 dillon Exp $
6                  */
7                 .text
8                 .globl  dozero1
9                 .globl  dozero2
10                 .globl  dozero3
11                 .globl  dozero4
12                 .globl  dozero5
13                 .globl  dozero6
14                 .globl  dozero7
15                 .globl  fpcleanup
17                 .p2align 4,0x90
18 dozero1:
19                 pushl   %esi
20                 pushl   %edi
21                 pushl   %ecx
22                 pushl   %ebx
24                 movl    4+16(%esp),%edi
25                 movl    8+16(%esp),%ecx
26                 shrl    $2,%ecx
27                 subl    %eax,%eax
28                 cld
29                 rep
30                 stosl
31                 popl    %ebx
32                 popl    %ecx
33                 popl    %edi
34                 popl    %esi
35                 ret
37                 .p2align 4,0x90
38 dozero2:
39                 pushl   %esi
40                 pushl   %edi
41                 pushl   %ecx
42                 pushl   %ebx
44                 movl    4+16(%esp),%edi
45                 movl    8+16(%esp),%ecx
46                 addl    %ecx,%esi
47                 addl    %ecx,%edi
48                 shrl    $2,%ecx
49                 subl    %eax,%eax
50                 std
51                 rep
52                 stosl
53                 popl    %ebx
54                 popl    %ecx
55                 popl    %edi
56                 popl    %esi
57                 ret
59                 .p2align 4,0x90
60 dozero3:
61                 pushl   %esi
62                 pushl   %edi
63                 pushl   %ecx
64                 pushl   %ebx
66                 movl    4+16(%esp),%edi
67                 movl    8+16(%esp),%ecx
68                 movl    $8,%edx
69                 subl    %eax,%eax
70                 .p2align 4,0x90
72                 subl    %edx,%ecx
73                 movl    %eax,(%edi)
74                 movl    %eax,4(%edi)
75                 addl    %edx,%edi
76                 testl   %ecx,%ecx
77                 jnz     1b
79                 popl    %ebx
80                 popl    %ecx
81                 popl    %edi
82                 popl    %esi
83                 ret
85                 .p2align 4,0x90
86 dozero4:
87                 pushl   %esi
88                 pushl   %edi
89                 pushl   %ecx
90                 pushl   %ebx
92                 movl    4+16(%esp),%edi
93                 movl    8+16(%esp),%ecx
94                 subl    %eax,%eax
95                 .p2align 4,0x90
97                 subl    $16,%ecx
98                 movnti  %eax,0(%edi)
99                 movnti  %eax,4(%edi)
100                 movnti  %eax,8(%edi)
101                 movnti  %eax,12(%edi)
102                 addl    $16,%edi
103                 testl   %ecx,%ecx
104                 jnz     1b
106                 popl    %ebx
107                 popl    %ecx
108                 popl    %edi
109                 popl    %esi
110                 ret
112                 .p2align 4,0x90
113 dozero5:
114                 pushl   %esi
115                 pushl   %edi
116                 pushl   %ecx
117                 pushl   %ebx
119                 movl    4+16(%esp),%edi
120                 movl    8+16(%esp),%ecx
122                 subl    $108,%esp
123                 fnsave  0(%esp)
124                 fninit
125                 fldz
126                 .p2align 4,0x90
128                 subl    $64,%ecx
129                 movq    %mm0,(%edi)
130                 movq    %mm1,8(%edi)
131                 movq    %mm2,16(%edi)
132                 movq    %mm3,24(%edi)
133                 movq    %mm4,32(%edi)
134                 movq    %mm5,40(%edi)
135                 movq    %mm6,48(%edi)
136                 movq    %mm7,56(%edi)
137                 addl    $64,%edi
138                 testl   %ecx,%ecx
139                 jnz     1b
141                 frstor  0(%esp)
142                 addl    $108,%esp
144                 popl    %ebx
145                 popl    %ecx
146                 popl    %edi
147                 popl    %esi
148                 ret
150                 .p2align 4,0x90
151 dozero6:
152                 pushl   %esi
153                 pushl   %edi
154                 pushl   %ecx
155                 pushl   %ebx
157                 movl    4+16(%esp),%edi
158                 movl    8+16(%esp),%ecx
159                 movl    $16,%eax
160                 .p2align 4,0x90
162                 subl    %eax,%ecx
163                 movq    %mm0,(%edi)
164                 movq    %mm1,8(%edi)
165                 addl    %eax,%edi
166                 testl   %ecx,%ecx
167                 jnz     1b
169                 popl    %ebx
170                 popl    %ecx
171                 popl    %edi
172                 popl    %esi
173                 ret
175                 .p2align 4,0x90
176 dozero7:
177                 pushl   %esi
178                 pushl   %edi
179                 pushl   %ecx
180                 pushl   %ebx
182                 movl    4+16(%esp),%edi
183                 movl    8+16(%esp),%ecx
184                 movl    $32,%eax
185                 .p2align 4,0x90
187                 subl    %eax,%ecx
188                 movntdq %xmm0,(%edi)
189                 movntdq %xmm1,16(%edi)
190                 addl    %eax,%edi
191                 testl   %ecx,%ecx
192                 jnz     1b
193                 sfence
195                 popl    %ebx
196                 popl    %ecx
197                 popl    %edi
198                 popl    %esi
199                 ret
201                 .p2align 4,0x90
202 fpcleanup:
203                 fninit
204                 ret