]>
Commit | Line | Data |
---|---|---|
a37f6605 AB |
1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
3 | # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r | |
4 | #\r | |
5 | # This program and the accompanying materials are licensed and made available\r | |
6 | # under the terms and conditions of the BSD License which accompanies this\r | |
7 | # distribution. The full text of the license may be found at\r | |
8 | # http://opensource.org/licenses/bsd-license.php\r | |
9 | #\r | |
10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | #\r | |
13 | #------------------------------------------------------------------------------\r | |
14 | \r | |
15 | .text\r | |
16 | .thumb\r | |
17 | .syntax unified\r | |
18 | .align 5\r | |
a37f6605 AB |
19 | ASM_GLOBAL ASM_PFX(InternalMemSetMem16)\r |
20 | ASM_PFX(InternalMemSetMem16):\r | |
21 | uxth r2, r2\r | |
8b4ca351 | 22 | lsl r1, r1, #1\r |
a37f6605 | 23 | orr r2, r2, r2, lsl #16\r |
8b4ca351 | 24 | b 0f\r |
a37f6605 AB |
25 | \r |
26 | ASM_GLOBAL ASM_PFX(InternalMemSetMem32)\r | |
27 | ASM_PFX(InternalMemSetMem32):\r | |
8b4ca351 AB |
28 | lsl r1, r1, #2\r |
29 | b 0f\r | |
a37f6605 AB |
30 | \r |
31 | ASM_GLOBAL ASM_PFX(InternalMemSetMem64)\r | |
32 | ASM_PFX(InternalMemSetMem64):\r | |
8b4ca351 AB |
33 | lsl r1, r1, #3\r |
34 | b 1f\r | |
35 | \r | |
36 | .align 5\r | |
37 | ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r | |
38 | ASM_PFX(InternalMemSetMem):\r | |
39 | uxtb r2, r2\r | |
40 | orr r2, r2, r2, lsl #8\r | |
41 | orr r2, r2, r2, lsl #16\r | |
42 | b 0f\r | |
43 | \r | |
44 | ASM_GLOBAL ASM_PFX(InternalMemZeroMem)\r | |
45 | ASM_PFX(InternalMemZeroMem):\r | |
46 | movs r2, #0\r | |
47 | 0: mov r3, r2\r | |
48 | \r | |
49 | 1: push {r4, lr}\r | |
a37f6605 AB |
50 | cmp r1, #16 // fewer than 16 bytes of input?\r |
51 | add r1, r1, r0 // r1 := dst + length\r | |
52 | add lr, r0, #16\r | |
53 | blt 2f\r | |
54 | bic lr, lr, #15 // align output pointer\r | |
55 | \r | |
56 | str r2, [r0] // potentially unaligned store of 4 bytes\r | |
57 | str r3, [r0, #4] // potentially unaligned store of 4 bytes\r | |
58 | str r2, [r0, #8] // potentially unaligned store of 4 bytes\r | |
59 | str r3, [r0, #12] // potentially unaligned store of 4 bytes\r | |
60 | beq 1f\r | |
61 | \r | |
62 | 0: add lr, lr, #16 // advance the output pointer by 16 bytes\r | |
63 | subs r4, r1, lr // past the output?\r | |
64 | blt 3f // break out of the loop\r | |
65 | strd r2, r3, [lr, #-16] // aligned store of 16 bytes\r | |
66 | strd r2, r3, [lr, #-8]\r | |
67 | bne 0b // goto beginning of loop\r | |
68 | 1: pop {r4, pc}\r | |
69 | \r | |
70 | 2: subs r4, r1, lr\r | |
71 | 3: adds r4, r4, #16\r | |
72 | subs r1, r1, #8\r | |
73 | cmp r4, #4 // between 4 and 15 bytes?\r | |
74 | blt 4f\r | |
75 | cmp r4, #8 // between 8 and 15 bytes?\r | |
76 | str r2, [lr, #-16] // overlapping store of 4 + (4 + 4) + 4 bytes\r | |
77 | itt gt\r | |
78 | strgt r3, [lr, #-12]\r | |
79 | strgt r2, [r1]\r | |
80 | str r3, [r1, #4]\r | |
81 | pop {r4, pc}\r | |
82 | \r | |
83 | 4: cmp r4, #2 // 2 or 3 bytes?\r | |
84 | strb r2, [lr, #-16] // store 1 byte\r | |
85 | it ge\r | |
86 | strhge r2, [r1, #6] // store 2 bytes\r | |
87 | pop {r4, pc}\r |