aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-31 01:39:20 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-31 01:39:20 -0400
commit156a84e80ff68441fcc630b1bfbc3eb7d881b267 (patch)
tree22beb01aa7934ee6efaafdcf37c806010a948727
parent021155db5b3cdbe524806ed549d96bb56e611a01 (diff)
downloadzig-156a84e80ff68441fcc630b1bfbc3eb7d881b267.tar.gz
zig-156a84e80ff68441fcc630b1bfbc3eb7d881b267.zip
compiler-rt: add __aeabi_uldivmod
-rw-r--r--std/special/compiler_rt/index.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/std/special/compiler_rt/index.zig b/std/special/compiler_rt/index.zig
index 7f11f7ddbf..54da5148e7 100644
--- 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,