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