dp-arm | 75b6057 | 2017-05-04 12:12:06 +0100 | [diff] [blame] | 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 | #if defined(__MINGW32__) |
| 20 | #define __aeabi_uldivmod __rt_udiv64 |
| 21 | #endif |
| 22 | |
| 23 | .syntax unified |
| 24 | .p2align 2 |
| 25 | DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod) |
| 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(__udivmoddi4) |
| 39 | ldr r2, [sp, #8] |
| 40 | ldr r3, [sp, #12] |
| 41 | add sp, sp, #16 |
| 42 | pop {r6, pc} |
| 43 | END_COMPILERRT_FUNCTION(__aeabi_uldivmod) |
| 44 | |
| 45 | NO_EXEC_STACK_DIRECTIVE |
| 46 | |