1 #------------------------------------------------------------------------------
3 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 #------------------------------------------------------------------------------
13 .type ASM_PFX(InternalMemSetMem16), %function
14 ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
15 ASM_PFX(InternalMemSetMem16):
18 orr r2, r2, r2, lsl #16
21 .type ASM_PFX(InternalMemSetMem32), %function
22 ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
23 ASM_PFX(InternalMemSetMem32):
27 .type ASM_PFX(InternalMemSetMem64), %function
28 ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
29 ASM_PFX(InternalMemSetMem64):
34 .type ASM_PFX(InternalMemSetMem), %function
35 ASM_GLOBAL ASM_PFX(InternalMemSetMem)
36 ASM_PFX(InternalMemSetMem):
38 orr r2, r2, r2, lsl #8
39 orr r2, r2, r2, lsl #16
42 .type ASM_PFX(InternalMemZeroMem), %function
43 ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
44 ASM_PFX(InternalMemZeroMem):
49 cmp r1, #16 // fewer than 16 bytes of input?
50 add r1, r1, r0 // r1 := dst + length
53 bic lr, lr, #15 // align output pointer
55 str r2, [r0] // potentially unaligned store of 4 bytes
56 str r3, [r0, #4] // potentially unaligned store of 4 bytes
57 str r2, [r0, #8] // potentially unaligned store of 4 bytes
58 str r3, [r0, #12] // potentially unaligned store of 4 bytes
61 0: add lr, lr, #16 // advance the output pointer by 16 bytes
62 subs r4, r1, lr // past the output?
63 blt 3f // break out of the loop
64 strd r2, r3, [lr, #-16] // aligned store of 16 bytes
65 strd r2, r3, [lr, #-8]
66 bne 0b // goto beginning of loop
72 cmp r4, #4 // between 4 and 15 bytes?
74 cmp r4, #8 // between 8 and 15 bytes?
76 str r2, [r4] // overlapping store of 4 + (4 + 4) + 4 bytes
84 4: cmp r4, #2 // 2 or 3 bytes?
85 strb r2, [lr, #-16] // store 1 byte
87 strhge.n r2, [r1, #6] // store 2 bytes