]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/CompilerIntrinsicsLib/Arm/ldivmod.S
Fix CodeSourcery 2010q1 link issue by adding missing intrinsics
[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)
19
20//
21// A pair of (unsigned) long longs is returned in {{r0, r1}, {r2, r3}},
22// the quotient in {r0, r1}, and the remainder in {r2, r3}.
23//
24//__value_in_regs lldiv_t
25//EFIAPI
26//__aeabi_ldivmod (
27// IN UINT64 Dividen
28// IN UINT64 Divisor
29// )//
30//
31
32ASM_PFX(__aeabi_ldivmod):
33 PUSH {r4,lr}
34 ASRS r4,r1,#1
35 EOR r4,r4,r3,LSR #1
36 BPL L_Test1
37 RSBS r0,r0,#0
38 RSC r1,r1,#0
39L_Test1:
40 TST r3,r3
41 BPL L_Test2
42 RSBS r2,r2,#0
43 RSC r3,r3,#0
44L_Test2:
45 BL ASM_PFX(__aeabi_uldivmod)
46 TST r4,#0x40000000
47 BEQ L_Test3
48 RSBS r0,r0,#0
49 RSC r1,r1,#0
50L_Test3:
51 TST r4,#0x80000000
52 BEQ L_Exit
53 RSBS r2,r2,#0
54 RSC r3,r3,#0
55L_Exit:
56 POP {r4,pc}
57
58
59