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