1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
5 ; SPDX-License-Identifier: BSD-2-Clause-Patent
7 ;------------------------------------------------------------------------------
9 EXPORT InternalMemZeroMem
10 EXPORT InternalMemSetMem
11 EXPORT InternalMemSetMem16
12 EXPORT InternalMemSetMem32
13 EXPORT InternalMemSetMem64
15 AREA SetMem, CODE, READONLY, CODEALIGN, ALIGN=5
21 orr r2, r2, r2, lsl #16
35 orr r2, r2, r2, lsl #8
36 orr r2, r2, r2, lsl #16
46 cmp r1, #16 ; fewer than 16 bytes of input?
47 add r1, r1, r0 ; r1 := dst + length
50 bic lr, lr, #15 ; align output pointer
52 str r2, [r0] ; potentially unaligned store of 4 bytes
53 str r3, [r0, #4] ; potentially unaligned store of 4 bytes
54 str r2, [r0, #8] ; potentially unaligned store of 4 bytes
55 str r3, [r0, #12] ; potentially unaligned store of 4 bytes
59 add lr, lr, #16 ; advance the output pointer by 16 bytes
60 subs r4, r1, lr ; past the output?
61 blt L3 ; break out of the loop
62 strd r2, r3, [lr, #-16] ; aligned store of 16 bytes
63 strd r2, r3, [lr, #-8]
64 bne L0 ; goto beginning of loop
73 cmp r4, #4 ; between 4 and 15 bytes?
75 cmp r4, #8 ; between 8 and 15 bytes?
76 str r2, [lr, #-16] ; overlapping store of 4 + (4 + 4) + 4 bytes
84 cmp r4, #2 ; 2 or 3 bytes?
85 strb r2, [lr, #-16] ; store 1 byte
87 strhge r2, [r1, #6] ; store 2 bytes