memset.S (2357939bc239bd5334a169b62313806178dd8f30) memset.S (31489a9a2653e123121e8ca39b4be802013d2b50)
1/* $NetBSD: memset.S,v 1.4 2003/10/14 07:51:45 scw Exp $ */
2
3/*
4 * Copyright 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 *

--- 146 unchanged lines hidden (view full) ---

155 stmgeia ip!, {r2-r3}
156 stmgeia ip!, {r2-r3}
157 stmgeia ip!, {r2-r3}
158 stmgeia ip!, {r2-r3}
159 stmgeia ip!, {r2-r3}
160 stmgeia ip!, {r2-r3}
161#endif
162 bgt .Lmemset_loop128
1/* $NetBSD: memset.S,v 1.4 2003/10/14 07:51:45 scw Exp $ */
2
3/*
4 * Copyright 2003 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Steve C. Woodford for Wasabi Systems, Inc.
8 *

--- 146 unchanged lines hidden (view full) ---

155 stmgeia ip!, {r2-r3}
156 stmgeia ip!, {r2-r3}
157 stmgeia ip!, {r2-r3}
158 stmgeia ip!, {r2-r3}
159 stmgeia ip!, {r2-r3}
160 stmgeia ip!, {r2-r3}
161#endif
162 bgt .Lmemset_loop128
163 moveq pc, lr /* Zero length so just exit */
163 RETeq /* Zero length so just exit */
164
165 add r1, r1, #0x80 /* Adjust for extra sub */
166
167 /* Do 32 bytes at a time */
168.Lmemset_loop32:
169 subs r1, r1, #0x20
170#ifdef __XSCALE__
171 strged r2, [ip], #0x08
172 strged r2, [ip], #0x08
173 strged r2, [ip], #0x08
174 strged r2, [ip], #0x08
175#else
176 stmgeia ip!, {r2-r3}
177 stmgeia ip!, {r2-r3}
178 stmgeia ip!, {r2-r3}
179 stmgeia ip!, {r2-r3}
180#endif
181 bgt .Lmemset_loop32
164
165 add r1, r1, #0x80 /* Adjust for extra sub */
166
167 /* Do 32 bytes at a time */
168.Lmemset_loop32:
169 subs r1, r1, #0x20
170#ifdef __XSCALE__
171 strged r2, [ip], #0x08
172 strged r2, [ip], #0x08
173 strged r2, [ip], #0x08
174 strged r2, [ip], #0x08
175#else
176 stmgeia ip!, {r2-r3}
177 stmgeia ip!, {r2-r3}
178 stmgeia ip!, {r2-r3}
179 stmgeia ip!, {r2-r3}
180#endif
181 bgt .Lmemset_loop32
182 moveq pc, lr /* Zero length so just exit */
182 RETeq /* Zero length so just exit */
183
184 adds r1, r1, #0x10 /* Partially adjust for extra sub */
185
186 /* Deal with 16 bytes or more */
187#ifdef __XSCALE__
188 strged r2, [ip], #0x08
189 strged r2, [ip], #0x08
190#else
191 stmgeia ip!, {r2-r3}
192 stmgeia ip!, {r2-r3}
193#endif
183
184 adds r1, r1, #0x10 /* Partially adjust for extra sub */
185
186 /* Deal with 16 bytes or more */
187#ifdef __XSCALE__
188 strged r2, [ip], #0x08
189 strged r2, [ip], #0x08
190#else
191 stmgeia ip!, {r2-r3}
192 stmgeia ip!, {r2-r3}
193#endif
194 moveq pc, lr /* Zero length so just exit */
194 RETeq /* Zero length so just exit */
195
196 addlt r1, r1, #0x10 /* Possibly adjust for extra sub */
197
198 /* We have at least 4 bytes so copy as words */
199.Lmemset_loop4:
200 subs r1, r1, #0x04
201 strge r3, [ip], #0x04
202 bgt .Lmemset_loop4
195
196 addlt r1, r1, #0x10 /* Possibly adjust for extra sub */
197
198 /* We have at least 4 bytes so copy as words */
199.Lmemset_loop4:
200 subs r1, r1, #0x04
201 strge r3, [ip], #0x04
202 bgt .Lmemset_loop4
203 moveq pc, lr /* Zero length so just exit */
203 RETeq /* Zero length so just exit */
204
205#ifdef __XSCALE__
206 /* Compensate for 64-bit alignment check */
207 adds r1, r1, #0x04
204
205#ifdef __XSCALE__
206 /* Compensate for 64-bit alignment check */
207 adds r1, r1, #0x04
208 moveq pc, lr
208 RETeq
209 cmp r1, #2
210#else
211 cmp r1, #-2
212#endif
213
214 strb r3, [ip], #0x01 /* Set 1 byte */
215 strgeb r3, [ip], #0x01 /* Set another byte */
216 strgtb r3, [ip] /* and a third */
209 cmp r1, #2
210#else
211 cmp r1, #-2
212#endif
213
214 strb r3, [ip], #0x01 /* Set 1 byte */
215 strgeb r3, [ip], #0x01 /* Set another byte */
216 strgtb r3, [ip] /* and a third */
217 mov pc, lr /* Exit */
217 RET /* Exit */
218
219.Lmemset_wordunaligned:
220 rsb r2, r2, #0x004
221 strb r3, [ip], #0x01 /* Set 1 byte */
222 cmp r2, #0x02
223 strgeb r3, [ip], #0x01 /* Set another byte */
224 sub r1, r1, r2
225 strgtb r3, [ip], #0x01 /* and a third */
226 cmp r1, #0x04 /* More than 4 bytes left? */
227 bge .Lmemset_wordaligned /* Yup */
228
229.Lmemset_lessthanfour:
230 cmp r1, #0x00
218
219.Lmemset_wordunaligned:
220 rsb r2, r2, #0x004
221 strb r3, [ip], #0x01 /* Set 1 byte */
222 cmp r2, #0x02
223 strgeb r3, [ip], #0x01 /* Set another byte */
224 sub r1, r1, r2
225 strgtb r3, [ip], #0x01 /* and a third */
226 cmp r1, #0x04 /* More than 4 bytes left? */
227 bge .Lmemset_wordaligned /* Yup */
228
229.Lmemset_lessthanfour:
230 cmp r1, #0x00
231 moveq pc, lr /* Zero length so exit */
231 RETeq /* Zero length so exit */
232 strb r3, [ip], #0x01 /* Set 1 byte */
233 cmp r1, #0x02
234 strgeb r3, [ip], #0x01 /* Set another byte */
235 strgtb r3, [ip] /* and a third */
232 strb r3, [ip], #0x01 /* Set 1 byte */
233 cmp r1, #0x02
234 strgeb r3, [ip], #0x01 /* Set another byte */
235 strgtb r3, [ip] /* and a third */
236 mov pc, lr /* Exit */
236 RET /* Exit */