aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/mppa_k1c/i64_smod.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mppa_k1c/i64_smod.c')
-rw-r--r--runtime/mppa_k1c/i64_smod.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/mppa_k1c/i64_smod.c b/runtime/mppa_k1c/i64_smod.c
new file mode 100644
index 00000000..d48f9e19
--- /dev/null
+++ b/runtime/mppa_k1c/i64_smod.c
@@ -0,0 +1,25 @@
+unsigned long long
+udivmoddi4(unsigned long long num, unsigned long long den, int modwanted);
+
+long long
+__compcert_i64_smod (long long a, long long b)
+{
+ int neg = 0;
+ long long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = 1;
+ }
+
+ if (b < 0)
+ b = -b;
+
+ res = udivmoddi4 (a, b, 1);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}