aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/mppa_k1c/i64_sdiv.c
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2018-05-21 16:34:36 +0200
committerCyril SIX <cyril.six@kalray.eu>2018-05-21 16:39:48 +0200
commit479aacd0254605942a3f48c3b8053af4d07f0f6c (patch)
tree7ddbddf078b86a30e693ae35721e08f54a0af11e /runtime/mppa_k1c/i64_sdiv.c
parentb81dbb863781a5f450cad0b01f90f729fb1a2244 (diff)
downloadcompcert-kvx-479aacd0254605942a3f48c3b8053af4d07f0f6c.tar.gz
compcert-kvx-479aacd0254605942a3f48c3b8053af4d07f0f6c.zip
MPPA - Added modulo and division 64 bits. Non certified
32 bits version are not yet there. Right now the code is directly from libgcc, compiled with k1-gcc because of builtins.
Diffstat (limited to 'runtime/mppa_k1c/i64_sdiv.c')
-rw-r--r--runtime/mppa_k1c/i64_sdiv.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/mppa_k1c/i64_sdiv.c b/runtime/mppa_k1c/i64_sdiv.c
new file mode 100644
index 00000000..97b3cd2f
--- /dev/null
+++ b/runtime/mppa_k1c/i64_sdiv.c
@@ -0,0 +1,29 @@
+unsigned long long
+udivmoddi4(unsigned long long num, unsigned long long den, int modwanted);
+
+long long
+__compcert_i64_sdiv (long long a, long long b)
+{
+ int neg = 0;
+ long long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = !neg;
+ }
+
+ if (b < 0)
+ {
+ b = -b;
+ neg = !neg;
+ }
+
+ res = udivmoddi4 (a, b, 0);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
+