commit 156a84e80ff68441fcc630b1bfbc3eb7d881b267 (tree)
parent 021155db5b3cdbe524806ed549d96bb56e611a01
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Thu, 31 Aug 2017 01:39:20 -0400
compiler-rt: add __aeabi_uldivmod
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/std/special/compiler_rt/index.zig b/std/special/compiler_rt/index.zig
@@ -36,6 +36,23 @@ export fn __umoddi3(a: u64, b: u64) -> u64 {
return r;
}
+const AeabiUlDivModResult = extern struct {
+ quot: u64,
+ rem: u64,
+};
+export fn __aeabi_uldivmod(numerator: u64, denominator: u64) -> AeabiUlDivModResult {
+ @setDebugSafety(this, is_test);
+ if (comptime isArmArch()) {
+ @setGlobalLinkage(__aeabi_uldivmod, builtin.GlobalLinkage.LinkOnce);
+ var result: AeabiUlDivModResult = undefined;
+ result.quot = __udivmoddi4(numerator, denominator, &result.rem);
+ return result;
+ }
+
+ @setGlobalLinkage(__aeabi_uldivmod, builtin.GlobalLinkage.Internal);
+ unreachable;
+}
+
fn isArmArch() -> bool {
return switch (builtin.arch) {
builtin.Arch.armv8_2a,