aeabi_uldivmod.S revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1//===-- aeabi_uldivmod.S - EABI uldivmod 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 { uint64_t quot, uint64_t rem}
13//        __aeabi_uldivmod(uint64_t numerator, uint64_t denominator) {
14//   uint64_t rem, quot;
15//   quot = __udivmoddi4(numerator, denominator, &rem);
16//   return {quot, rem};
17// }
18
19        .syntax unified
20        .p2align 2
21DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod)
22        push	{r11, lr}
23        sub	sp, sp, #16
24        add	r12, sp, #8
25        str	r12, [sp]
26        bl	SYMBOL_NAME(__udivmoddi4)
27        ldr	r2, [sp, #8]
28        ldr	r3, [sp, #12]
29        add	sp, sp, #16
30        pop	{r11, pc}
31END_COMPILERRT_FUNCTION(__aeabi_uldivmod)
32