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