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