]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S
MdePkg/BaseMemoryLibOptDxe: replace deprecated uses of IT blocks
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibOptDxe / Arm / SetMem.S
CommitLineData
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
19ASM_GLOBAL ASM_PFX(InternalMemSetMem16)\r
20ASM_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
26ASM_GLOBAL ASM_PFX(InternalMemSetMem32)\r
27ASM_PFX(InternalMemSetMem32):\r
8b4ca351
AB
28 lsl r1, r1, #2\r
29 b 0f\r
a37f6605
AB
30\r
31ASM_GLOBAL ASM_PFX(InternalMemSetMem64)\r
32ASM_PFX(InternalMemSetMem64):\r
8b4ca351
AB
33 lsl r1, r1, #3\r
34 b 1f\r
35\r
36 .align 5\r
37ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r
38ASM_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
44ASM_GLOBAL ASM_PFX(InternalMemZeroMem)\r
45ASM_PFX(InternalMemZeroMem):\r
46 movs r2, #0\r
470: mov r3, r2\r
48\r
491: 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
620: 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
681: pop {r4, pc}\r
69\r
702: subs r4, r1, lr\r
713: 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
eab26788
AB
76 sub r4, lr, #16\r
77 str r2, [r4] // overlapping store of 4 + (4 + 4) + 4 bytes\r
78 it gt\r
79 strgt.n r3, [r4, #4]\r
80 it gt\r
81 strgt.n r2, [r1]\r
a37f6605
AB
82 str r3, [r1, #4]\r
83 pop {r4, pc}\r
84\r
854: cmp r4, #2 // 2 or 3 bytes?\r
86 strb r2, [lr, #-16] // store 1 byte\r
87 it ge\r
eab26788 88 strhge.n r2, [r1, #6] // store 2 bytes\r
a37f6605 89 pop {r4, pc}\r