1//===-- aeabi_ldivmod.S - EABI ldivmod implementation ---------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "../assembly.h"
11
12// struct { int64_t quot, int64_t rem}
13//        __aeabi_ldivmod(int64_t numerator, int64_t denominator) {
14//   int64_t rem, quot;
15//   quot = __divmoddi4(numerator, denominator, &rem);
16//   return {quot, rem};
17// }
18
19        .syntax unified
20        .p2align 2
21DEFINE_COMPILERRT_FUNCTION(__aeabi_ldivmod)
22        push    {r11, lr}
23        sub     sp, sp, #16
24        add     r12, sp, #8
25        str     r12, [sp]
26        bl      SYMBOL_NAME(__divmoddi4)
27        ldr     r2, [sp, #8]
28        ldr     r3, [sp, #12]
29        add     sp, sp, #16
30        pop     {r11, pc}
31END_COMPILERRT_FUNCTION(__aeabi_ldivmod)
32