]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/CompilerIntrinsicsLib/Arm/udivmoddi4.S
ArmPkg/CompilerIntrinsicsLib: switch to ASM_FUNC() asm macro
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / udivmoddi4.S
CommitLineData
3402aac7 1#------------------------------------------------------------------------------\r
1e57a462 2#\r
3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
4#\r
5# This program and the accompanying materials\r
6# are licensed and made available under the terms and conditions of the BSD License\r
7# which accompanies this 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
903e3124
AB
15#include <AsmMacroIoLib.h>\r
16\r
1a0db791 17 .syntax unified\r
3402aac7 18\r
903e3124 19ASM_FUNC(__udivmoddi4)\r
1e57a462 20 stmfd sp!, {r4, r5, r6, r7, lr}\r
21 add r7, sp, #12\r
22 stmfd sp!, {r10, r11}\r
23 sub sp, sp, #20\r
24 stmia sp, {r2-r3}\r
25 ldr r6, [sp, #48]\r
26 orrs r2, r2, r3\r
27 mov r10, r0\r
28 mov r11, r1\r
29 beq L2\r
30 subs ip, r1, #0\r
31 bne L4\r
32 cmp r3, #0\r
33 bne L6\r
34 cmp r6, #0\r
35 beq L8\r
36 mov r1, r2\r
37 bl ASM_PFX(__umodsi3)\r
38 mov r1, #0\r
39 stmia r6, {r0-r1}\r
40L8:\r
41 ldr r1, [sp, #0]\r
42 mov r0, r10\r
43 b L45\r
44L6:\r
45 cmp r6, #0\r
46 movne r1, #0\r
1a0db791 47 stmiane r6, {r0-r1}\r
1e57a462 48 b L2\r
49L4:\r
50 ldr r1, [sp, #0]\r
51 cmp r1, #0\r
52 bne L12\r
53 ldr r2, [sp, #4]\r
54 cmp r2, #0\r
55 bne L14\r
56 cmp r6, #0\r
57 beq L16\r
58 mov r1, r2\r
59 mov r0, r11\r
60 bl ASM_PFX(__umodsi3)\r
61 mov r1, #0\r
62 stmia r6, {r0-r1}\r
63L16:\r
64 ldr r1, [sp, #4]\r
65 mov r0, r11\r
66L45:\r
67 bl ASM_PFX(__udivsi3)\r
68L46:\r
69 mov r10, r0\r
70 mov r11, #0\r
71 b L10\r
72L14:\r
73 subs r1, r0, #0\r
74 bne L18\r
75 cmp r6, #0\r
76 beq L16\r
77 ldr r1, [sp, #4]\r
78 mov r0, r11\r
79 bl ASM_PFX(__umodsi3)\r
80 mov r4, r10\r
81 mov r5, r0\r
82 stmia r6, {r4-r5}\r
83 b L16\r
84L18:\r
85 sub r3, r2, #1\r
86 tst r2, r3\r
87 bne L22\r
88 cmp r6, #0\r
89 movne r4, r0\r
90 andne r5, ip, r3\r
1a0db791 91 stmiane r6, {r4-r5}\r
1e57a462 92L24:\r
93 rsb r3, r2, #0\r
94 and r3, r2, r3\r
95 clz r3, r3\r
96 rsb r3, r3, #31\r
97 mov r0, ip, lsr r3\r
98 b L46\r
99L22:\r
100 clz r2, r2\r
101 clz r3, ip\r
102 rsb r3, r3, r2\r
103 cmp r3, #30\r
104 bhi L48\r
105 rsb r2, r3, #31\r
106 add lr, r3, #1\r
107 mov r3, r1, asl r2\r
108 str r3, [sp, #12]\r
109 mov r3, r1, lsr lr\r
110 ldr r0, [sp, #0]\r
111 mov r5, ip, lsr lr\r
112 orr r4, r3, ip, asl r2\r
113 str r0, [sp, #8]\r
114 b L29\r
115L12:\r
116 ldr r3, [sp, #4]\r
117 cmp r3, #0\r
118 bne L30\r
119 sub r3, r1, #1\r
120 tst r1, r3\r
121 bne L32\r
122 cmp r6, #0\r
123 andne r3, r3, r0\r
124 movne r2, r3\r
125 movne r3, #0\r
1a0db791 126 stmiane r6, {r2-r3}\r
1e57a462 127L34:\r
128 cmp r1, #1\r
129 beq L10\r
130 rsb r3, r1, #0\r
131 and r3, r1, r3\r
132 clz r3, r3\r
133 rsb r0, r3, #31\r
134 mov r1, ip, lsr r0\r
135 rsb r3, r0, #32\r
136 mov r0, r10, lsr r0\r
137 orr ip, r0, ip, asl r3\r
138 str r1, [sp, #12]\r
139 str ip, [sp, #8]\r
140 ldrd r10, [sp, #8]\r
141 b L10\r
142L32:\r
143 clz r2, r1\r
144 clz r3, ip\r
145 rsb r3, r3, r2\r
146 rsb r4, r3, #31\r
147 mov r2, r0, asl r4\r
148 mvn r1, r3\r
149 and r2, r2, r1, asr #31\r
150 add lr, r3, #33\r
151 str r2, [sp, #8]\r
152 add r2, r3, #1\r
153 mov r3, r3, asr #31\r
154 and r0, r3, r0, asl r1\r
155 mov r3, r10, lsr r2\r
156 orr r3, r3, ip, asl r4\r
157 and r3, r3, r1, asr #31\r
158 orr r0, r0, r3\r
159 mov r3, ip, lsr lr\r
160 str r0, [sp, #12]\r
161 mov r0, r10, lsr lr\r
162 and r5, r3, r2, asr #31\r
163 rsb r3, lr, #31\r
164 mov r3, r3, asr #31\r
165 orr r0, r0, ip, asl r1\r
166 and r3, r3, ip, lsr r2\r
167 and r0, r0, r2, asr #31\r
168 orr r4, r3, r0\r
169 b L29\r
170L30:\r
171 clz r2, r3\r
172 clz r3, ip\r
173 rsb r3, r3, r2\r
174 cmp r3, #31\r
175 bls L37\r
176L48:\r
177 cmp r6, #0\r
1a0db791 178 stmiane r6, {r10-r11}\r
1e57a462 179 b L2\r
180L37:\r
181 rsb r1, r3, #31\r
182 mov r0, r0, asl r1\r
183 add lr, r3, #1\r
184 mov r2, #0\r
185 str r0, [sp, #12]\r
186 mov r0, r10, lsr lr\r
187 str r2, [sp, #8]\r
188 sub r2, r3, #31\r
189 and r0, r0, r2, asr #31\r
190 mov r3, ip, lsr lr\r
191 orr r4, r0, ip, asl r1\r
192 and r5, r3, r2, asr #31\r
193L29:\r
194 mov ip, #0\r
195 mov r10, ip\r
196 b L40\r
197L41:\r
198 ldr r1, [sp, #12]\r
199 ldr r2, [sp, #8]\r
200 mov r3, r4, lsr #31\r
201 orr r5, r3, r5, asl #1\r
202 mov r3, r1, lsr #31\r
203 orr r4, r3, r4, asl #1\r
204 mov r3, r2, lsr #31\r
205 orr r0, r3, r1, asl #1\r
206 orr r1, ip, r2, asl #1\r
207 ldmia sp, {r2-r3}\r
208 str r0, [sp, #12]\r
209 subs r2, r2, r4\r
210 sbc r3, r3, r5\r
211 str r1, [sp, #8]\r
212 subs r0, r2, #1\r
213 sbc r1, r3, #0\r
214 mov r2, r1, asr #31\r
215 ldmia sp, {r0-r1}\r
216 mov r3, r2\r
217 and ip, r2, #1\r
218 and r3, r3, r1\r
219 and r2, r2, r0\r
220 subs r4, r4, r2\r
221 sbc r5, r5, r3\r
222 add r10, r10, #1\r
223L40:\r
224 cmp r10, lr\r
225 bne L41\r
226 ldrd r0, [sp, #8]\r
227 adds r0, r0, r0\r
228 adc r1, r1, r1\r
229 cmp r6, #0\r
230 orr r10, r0, ip\r
231 mov r11, r1\r
1a0db791 232 stmiane r6, {r4-r5}\r
1e57a462 233 b L10\r
234L2:\r
235 mov r10, #0\r
236 mov r11, #0\r
237L10:\r
238 mov r0, r10\r
239 mov r1, r11\r
240 sub sp, r7, #20\r
241 ldmfd sp!, {r10, r11}\r
242 ldmfd sp!, {r4, r5, r6, r7, pc}\r