aboutsummaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-16 14:27:06 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-16 14:27:06 +0200
commitca92d5ab93f2ee63ff416a096fdbfa569a64c717 (patch)
tree8f0663009230cf504daee7a9dc8c9fa83e886842 /runtime
parent2981acd39bb23b783339fa6848aa284bfae938c0 (diff)
downloadcompcert-kvx-ca92d5ab93f2ee63ff416a096fdbfa569a64c717.tar.gz
compcert-kvx-ca92d5ab93f2ee63ff416a096fdbfa569a64c717.zip
sdiv seems to work, udiv/umod/smod BOGUS
Diffstat (limited to 'runtime')
-rw-r--r--runtime/mppa_k1c/i64_sdiv.c10
-rw-r--r--runtime/mppa_k1c/i64_smod.c40
-rw-r--r--runtime/mppa_k1c/vararg.S51
3 files changed, 51 insertions, 50 deletions
diff --git a/runtime/mppa_k1c/i64_sdiv.c b/runtime/mppa_k1c/i64_sdiv.c
index 9feab791..809f2b1c 100644
--- a/runtime/mppa_k1c/i64_sdiv.c
+++ b/runtime/mppa_k1c/i64_sdiv.c
@@ -1,15 +1,5 @@
extern long __divdi3 (long a, long b);
-long i64_sdiv (long a, long b)
-{
- return __divdi3 (a, b);
-}
-
-int i32_sdiv (int a, int b)
-{
- return __divdi3 (a, b);
-}
-
#include <mppa_bare_runtime/k1c/registers.h>
/* DM FIXME this is for floating point */
diff --git a/runtime/mppa_k1c/i64_smod.c b/runtime/mppa_k1c/i64_smod.c
index 26ffb39b..e69de29b 100644
--- a/runtime/mppa_k1c/i64_smod.c
+++ b/runtime/mppa_k1c/i64_smod.c
@@ -1,40 +0,0 @@
-#if COMPLIQUE
-unsigned long long
-udivmoddi4(unsigned long long num, unsigned long long den, int modwanted);
-
-long long
-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;
-}
-
-#else
-extern long __moddi3 (long a, long b);
-
-long i64_smod (long a, long b)
-{
- return __moddi3 (a, b);
-}
-
-int i32_smod (int a, int b)
-{
- return __moddi3 (a, b);
-}
-#endif
diff --git a/runtime/mppa_k1c/vararg.S b/runtime/mppa_k1c/vararg.S
index 9e23e0b3..2050c9aa 100644
--- a/runtime/mppa_k1c/vararg.S
+++ b/runtime/mppa_k1c/vararg.S
@@ -52,3 +52,54 @@ __compcert_acswapw:
sq 0[$r0] = $r2r3
ret
;;
+
+ .globl __compcert_i32_sdiv
+ .globl __compcert_i32_smod
+ .globl __compcert_i32_udiv
+ .globl __compcert_i32_umod
+__compcert_i32_sdiv:
+__compcert_i32_smod:
+__compcert_i32_udiv:
+__compcert_i32_umod:
+ sxwd $r0 = $r0
+ ;; /* Can't issue next in the same bundle */
+ sxwd $r1 = $r1
+ ;; /* Can't issue next in the same bundle */
+ make $r2 = 0x3ff0000000000000
+ addd $r12 = $r12, -16
+ ;;
+ floatd.rn.s $r0 = $r0, 0
+ ;;
+ floatd.rn.s $r3 = $r1, 0
+ ;;
+ floatw.rn.s $r1 = $r1, 0
+ ;;
+ ;;
+#APP
+# 16 "clock_int_div2.c" 1
+ finvw $r1=$r1
+# 0 "" 2
+ ;;
+
+ ;;
+#NO_APP
+ fwidenlwd $r1 = $r1
+ ;;
+ fmuld $r0 = $r0, $r1
+ ;;
+ ffmsd $r2 = $r1, $r3
+ ;;
+ sd 8[$r12] = $r0
+ ;;
+ ld $r1 = 8[$r12]
+ ;;
+ ffmad $r1 = $r2, $r0
+ ;;
+ ffmad $r0 = $r2, $r1
+ ;;
+ sd 8[$r12] = $r1
+ addd $r12 = $r12, 16
+ ;;
+ fixedd.rz $r0 = $r0, 0
+ ret
+ ;;