aeabi_idivmod.S revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1//===-- aeabi_idivmod.S - EABI idivmod 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 { int quot, int rem} __aeabi_idivmod(int numerator, int denominator) {
13//   int rem, quot;
14//   quot = __divmodsi4(numerator, denominator, &rem);
15//   return {quot, rem};
16// }
17
18        .syntax unified
19        .p2align 2
20DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod)
21        push    { lr }
22        sub     sp, sp, #4
23        mov     r2, sp
24        bl      SYMBOL_NAME(__divmodsi4)
25        ldr     r1, [sp]
26        add     sp, sp, #4
27        pop     { pc }
28END_COMPILERRT_FUNCTION(__aeabi_idivmod)
29