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 |
16 | .align 2\r |
17 | GCC_ASM_EXPORT(__udivsi3)\r |
18 | \r |
19 | ASM_PFX(__udivsi3):\r |
20 | cmp r1, #0\r |
21 | cmpne r0, #0\r |
22 | stmfd sp!, {r4, r5, r7, lr}\r |
23 | add r7, sp, #8\r |
24 | beq L2\r |
25 | clz r2, r1\r |
26 | clz r3, r0\r |
27 | rsb r3, r3, r2\r |
28 | cmp r3, #31\r |
29 | bhi L2\r |
30 | ldmeqfd sp!, {r4, r5, r7, pc}\r |
31 | add r5, r3, #1\r |
32 | rsb r3, r3, #31\r |
33 | mov lr, #0\r |
34 | mov r2, r0, asl r3\r |
35 | mov ip, r0, lsr r5\r |
36 | mov r4, lr\r |
37 | b L8\r |
38 | L9:\r |
39 | mov r0, r2, lsr #31\r |
40 | orr ip, r0, ip, asl #1\r |
41 | orr r2, r3, lr\r |
42 | rsb r3, ip, r1\r |
43 | sub r3, r3, #1\r |
44 | and r0, r1, r3, asr #31\r |
45 | mov lr, r3, lsr #31\r |
46 | rsb ip, r0, ip\r |
47 | add r4, r4, #1\r |
48 | L8:\r |
49 | cmp r4, r5\r |
50 | mov r3, r2, asl #1\r |
51 | bne L9\r |
52 | orr r0, r3, lr\r |
53 | ldmfd sp!, {r4, r5, r7, pc}\r |
54 | L2:\r |
55 | mov r0, #0\r |
56 | ldmfd sp!, {r4, r5, r7, pc}\r |
57 | \r |