1 //===-- aeabi_uidivmod.S - EABI uidivmod implementation -------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "../assembly.h"
11 // struct { unsigned quot, unsigned rem}
12 // __aeabi_uidivmod(unsigned numerator, unsigned denominator) {
13 // unsigned rem, quot;
14 // quot = __udivmodsi4(numerator, denominator, &rem);
15 // return {quot, rem};
18 #if defined(__MINGW32__)
19 #define __aeabi_uidivmod __rt_udiv
26 DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod)
27 #if defined(USE_THUMB_1)
29 bcc LOCAL_LABEL(case_denom_larger)
31 bl SYMBOL_NAME(__aeabi_uidiv)
33 muls r2, r0, r2 // r2 = quot * denom
36 LOCAL_LABEL(case_denom_larger):
40 #else // defined(USE_THUMB_1)
44 #if defined(__MINGW32__)
49 bl SYMBOL_NAME(__udivmodsi4)
54 END_COMPILERRT_FUNCTION(__aeabi_uidivmod)
56 NO_EXEC_STACK_DIRECTIVE