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