Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/arm/aeabi_uidivmod.S
35291 views
//===-- aeabi_uidivmod.S - EABI uidivmod implementation -------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "../assembly.h"910// struct { unsigned quot, unsigned rem}11// __aeabi_uidivmod(unsigned numerator, unsigned denominator) {12// unsigned rem, quot;13// quot = __udivmodsi4(numerator, denominator, &rem);14// return {quot, rem};15// }1617#if defined(__MINGW32__)18#define __aeabi_uidivmod __rt_udiv19#endif2021.syntax unified22.text23DEFINE_CODE_STATE24.p2align 225DEFINE_COMPILERRT_FUNCTION(__aeabi_uidivmod)26#if defined(USE_THUMB_1)27cmp r0, r128bcc LOCAL_LABEL(case_denom_larger)29push {r0, r1, lr}30bl SYMBOL_NAME(__aeabi_uidiv)31pop {r1, r2, r3}32muls r2, r0, r2 // r2 = quot * denom33subs r1, r1, r234JMP (r3)35LOCAL_LABEL(case_denom_larger):36movs r1, r037movs r0, #038JMP (lr)39#else // defined(USE_THUMB_1)40push { lr }41sub sp, sp, #442mov r2, sp43#if defined(__MINGW32__)44mov r3, r045mov r0, r146mov r1, r347#endif48bl SYMBOL_NAME(__udivmodsi4)49ldr r1, [sp]50add sp, sp, #451pop { pc }52#endif53END_COMPILERRT_FUNCTION(__aeabi_uidivmod)5455NO_EXEC_STACK_DIRECTIVE56575859