1#------------------------------------------------------------------------------
2#
3# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4#
5# SPDX-License-Identifier: BSD-2-Clause-Patent
6#
7#------------------------------------------------------------------------------
8
9#include <AsmMacroIoLib.h>
10
11ASM_FUNC(__moddi3)
12  stmfd  sp!, {r4, r5, r7, lr}
13  mov  r4, r1, asr #31
14  add  r7, sp, #8
15  stmfd  sp!, {r10, r11}
16  mov  r10, r3, asr #31
17  sub  sp, sp, #16
18  mov  r5, r4
19  mov  r11, r10
20  eor  r0, r0, r4
21  eor  r1, r1, r4
22  eor  r2, r2, r10
23  eor  r3, r3, r10
24  add  ip, sp, #8
25  subs  r0, r0, r4
26  sbc  r1, r1, r5
27  subs  r2, r2, r10
28  sbc  r3, r3, r11
29  str  ip, [sp, #0]
30  bl  ASM_PFX(__udivmoddi4)
31  ldrd  r0, [sp, #8]
32  eor  r0, r0, r4
33  eor  r1, r1, r4
34  subs  r0, r0, r4
35  sbc  r1, r1, r5
36  sub  sp, r7, #16
37  ldmfd  sp!, {r10, r11}
38  ldmfd  sp!, {r4, r5, r7, pc}
39