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#if defined(__MINGW32__) 20#define __aeabi_ldivmod __rt_sdiv64 21#endif 22 23 .syntax unified 24 .p2align 2 25DEFINE_COMPILERRT_FUNCTION(__aeabi_ldivmod) 26 push {r6, lr} 27 sub sp, sp, #16 28 add r6, sp, #8 29 str r6, [sp] 30#if defined(__MINGW32__) 31 movs r6, r0 32 movs r0, r2 33 movs r2, r6 34 movs r6, r1 35 movs r1, r3 36 movs r3, r6 37#endif 38 bl SYMBOL_NAME(__divmoddi4) 39 ldr r2, [sp, #8] 40 ldr r3, [sp, #12] 41 add sp, sp, #16 42 pop {r6, pc} 43END_COMPILERRT_FUNCTION(__aeabi_ldivmod) 44 45NO_EXEC_STACK_DIRECTIVE 46 47