56 lines · plain
1//===-- aeabi_uldivmod.S - EABI uldivmod implementation -------------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "../assembly.h"10 11// struct { uint64_t quot, uint64_t rem}12// __aeabi_uldivmod(uint64_t numerator, uint64_t denominator) {13// uint64_t rem, quot;14// quot = __udivmoddi4(numerator, denominator, &rem);15// return {quot, rem};16// }17 18#if defined(__MINGW32__)19#define __aeabi_uldivmod __rt_udiv6420#endif21 22 .syntax unified23 .p2align 224DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod)25 PACBTI_LANDING26#if defined(__ARM_FEATURE_PAC_DEFAULT)27 push {r6, r12, lr}28#else29 push {r6, lr}30#endif31 sub sp, sp, #1632 add r6, sp, #833 str r6, [sp]34#if defined(__MINGW32__)35 movs r6, r036 movs r0, r237 movs r2, r638 movs r6, r139 movs r1, r340 movs r3, r641#endif42 bl SYMBOL_NAME(__udivmoddi4)43 ldr r2, [sp, #8]44 ldr r3, [sp, #12]45 add sp, sp, #1646#if defined(__ARM_FEATURE_PAC_DEFAULT)47 pop {r6, r12, lr}48 PAC_RETURN49#else50 pop {r6, pc}51#endif52END_COMPILERRT_FUNCTION(__aeabi_uldivmod)53 54NO_EXEC_STACK_DIRECTIVE55 56