]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
Update remaining ARM .S files with INTERWORK_FUNC macro. This is the 2nd half of...
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / Arm / ldivmod.S
CommitLineData
54a70131 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
16 .text
17 .align 2
18 .globl ASM_PFX(__aeabi_ldivmod)
63ca7402 19 INTERWORK_FUNC(__aeabi_ldivmod)\r
54a70131 20
21//
22// A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}},
23// the quotient in {r0, r1}, and the remainder in {r2, r3}.
24//
25//__value_in_regs lldiv_t
26//EFIAPI
27//__aeabi_ldivmod (
28// IN UINT64 Dividen
29// IN UINT64 Divisor
30// )//
31//
32
33ASM_PFX(__aeabi_ldivmod):
28d19165 34 push {r4,lr}
35 asrs r4,r1,#1
36 eor r4,r4,r3,LSR #1
37 bpl L_Test1
38 rsbs r0,r0,#0
39 rsc r1,r1,#0
54a70131 40L_Test1:
28d19165 41 tst r3,r3
42 bpl L_Test2
43 rsbs r2,r2,#0
44 rsc r3,r3,#0
54a70131 45L_Test2:
28d19165 46 bl ASM_PFX(__aeabi_uldivmod)
47 tst r4,#0x40000000
48 beq L_Test3
49 rsbs r0,r0,#0
50 rsc r1,r1,#0
54a70131 51L_Test3:
28d19165 52 tst r4,#0x80000000
53 beq L_Exit
54 rsbs r2,r2,#0
55 rsc r3,r3,#0
54a70131 56L_Exit:
28d19165 57 pop {r4,pc}
54a70131 58
59
60