aeabi_uldivmod.S 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "../assembly.h"
  9. // struct { uint64_t quot, uint64_t rem}
  10. // __aeabi_uldivmod(uint64_t numerator, uint64_t denominator) {
  11. // uint64_t rem, quot;
  12. // quot = __udivmoddi4(numerator, denominator, &rem);
  13. // return {quot, rem};
  14. // }
  15. #if defined(__MINGW32__)
  16. #define __aeabi_uldivmod __rt_udiv64
  17. #endif
  18. .syntax unified
  19. .p2align 2
  20. DEFINE_COMPILERRT_FUNCTION(__aeabi_uldivmod)
  21. push {r6, lr}
  22. sub sp, sp, #16
  23. add r6, sp, #8
  24. str r6, [sp]
  25. #if defined(__MINGW32__)
  26. movs r6, r0
  27. movs r0, r2
  28. movs r2, r6
  29. movs r6, r1
  30. movs r1, r3
  31. movs r3, r6
  32. #endif
  33. bl SYMBOL_NAME(__udivmoddi4)
  34. ldr r2, [sp, #8]
  35. ldr r3, [sp, #12]
  36. add sp, sp, #16
  37. pop {r6, pc}
  38. END_COMPILERRT_FUNCTION(__aeabi_uldivmod)
  39. NO_EXEC_STACK_DIRECTIVE