1 //===-- aeabi_idivmod.S - EABI idivmod implementation ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "../assembly.h"
12 // struct { int quot, int rem} __aeabi_idivmod(int numerator, int denominator) {
14 // quot = __divmodsi4(numerator, denominator, &rem);
15 // return {quot, rem};
18 #if defined(__MINGW32__)
19 #define __aeabi_idivmod __rt_sdiv
24 DEFINE_COMPILERRT_FUNCTION(__aeabi_idivmod)
25 #if __ARM_ARCH_ISA_THUMB == 1
27 bl SYMBOL_NAME(__divsi3)
28 pop {r1, r2, r3} // now r0 = quot, r1 = num, r2 = denom
29 muls r2, r2, r0 // r2 = quot * denom
36 #if defined(__MINGW32__)
41 bl SYMBOL_NAME(__divmodsi4)
45 #endif // __ARM_ARCH_ISA_THUMB == 1
46 END_COMPILERRT_FUNCTION(__aeabi_idivmod)
48 NO_EXEC_STACK_DIRECTIVE