Path: blob/master/libs/compiler-rt/lib/builtins/arm/aeabi_uidivmod.S
4396 views
//===-- aeabi_uidivmod.S - EABI uidivmod implementation -------------------===//1//2// The LLVM Compiler Infrastructure3//4// This file is dual licensed under the MIT and the University of Illinois Open5// Source Licenses. See LICENSE.TXT for details.6//7//===----------------------------------------------------------------------===//89#include "../assembly.h"1011// 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};16// }1718#if defined(_WIN32)19#define __aeabi_uidivmod __rt_udiv20#endif2122.syntax unified23.text24DEFINE_CODE_STATE25.p2align 226DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod)27#if defined(USE_THUMB_1)28cmp r0, r129bcc LOCAL_LABEL(case_denom_larger)30push {r0, r1, lr}31bl SYMBOL_NAME(__aeabi_uidiv)32pop {r1, r2, r3}33muls r2, r0, r2 // r2 = quot * denom34subs r1, r1, r235JMP (r3)36LOCAL_LABEL(case_denom_larger):37movs r1, r038movs r0, #039JMP (lr)40#else // defined(USE_THUMB_1)41push { lr }42sub sp, sp, #443mov r2, sp44#if defined(_WIN32)45mov r3, r046mov r0, r147mov r1, r348#endif49bl SYMBOL_NAME(__udivmodsi4)50ldr r1, [sp]51add sp, sp, #452pop { pc }53#endif54END_COMPILERRT_FUNCTION(__aeabi_uidivmod)5556NO_EXEC_STACK_DIRECTIVE575859