summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-10-24 16:16:11 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-10-24 16:16:11 +0000
commitf04797fa5517b002a9a47f4d34eb72e2a686c6bf (patch)
treefc02694269702b0efdcaf97068ffbc6f604e8f17
parent2daa336fad4620e09ff12770b6b4c72954f77b88 (diff)
downloadocaml-f04797fa5517b002a9a47f4d34eb72e2a686c6bf.tar.gz
Portage 680x0
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1096 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--testasmcomp/m68k.S58
-rw-r--r--testasmcomp/main.c3
-rw-r--r--testasmcomp/quicksort2.cmm18
3 files changed, 70 insertions, 9 deletions
diff --git a/testasmcomp/m68k.S b/testasmcomp/m68k.S
new file mode 100644
index 0000000000..3c11af5b21
--- /dev/null
+++ b/testasmcomp/m68k.S
@@ -0,0 +1,58 @@
+|***********************************************************************
+|* *
+|* Objective Caml *
+|* *
+|* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
+|* *
+|* Copyright 1996 Institut National de Recherche en Informatique et *
+|* Automatique. Distributed only by permission. *
+|* *
+|***********************************************************************
+
+| $Id$
+
+| call_gen_code is used with the following types:
+| unit -> int
+| int -> int
+| int -> double
+| int * int * address -> void
+| int * int -> void
+| unit -> unit
+| Hence arg1 -> d0, arg2 -> d1, arg3 -> a0,
+| and we need a special case for int -> double
+
+ .text
+ .globl _call_gen_code
+_call_gen_code:
+ link a6, #0
+ movem d2-d7/a2-a6, a7@-
+ fmovem fp2-fp7, a7@-
+ movel a6@(8), a1
+ movel a6@(12), d0
+ movel a6@(16), d1
+ movel a6@(20), a0
+ jsr a1@
+ fmovem a7@+, fp2-fp7
+ movem a7@+, d2-d7/a2-a6
+ unlk a6
+ rts
+
+ .globl _call_gen_code_float
+_call_gen_code_float:
+ link a6, #0
+ moveml d2-d7/a2-a6, a7@-
+ fmovem fp2-fp7, a7@-
+ movel a6@(8), a1
+ movel a6@(12), d0
+ jsr a1@
+ fmoved fp0, a7@-
+ movel a7@+, d0
+ movel a7@+, d1
+ fmovem a7@+, fp2-fp7
+ moveml a7@+, d2-d7/a2-a6
+ unlk a6
+ rts
+
+ .globl _caml_c_call
+_caml_c_call:
+ jmp a0@
diff --git a/testasmcomp/main.c b/testasmcomp/main.c
index 214b481e18..f1e8cf50db 100644
--- a/testasmcomp/main.c
+++ b/testasmcomp/main.c
@@ -51,6 +51,9 @@ int main(argc, argv)
#endif
#ifdef INT_FLOAT
{ extern double FUN();
+#ifdef __mc68020__
+#define call_gen_code call_gen_code_float
+#endif
extern double call_gen_code();
printf("%f\n", call_gen_code(FUN, atoi(argv[1])));
}
diff --git a/testasmcomp/quicksort2.cmm b/testasmcomp/quicksort2.cmm
index b1d3453caf..ca41dae717 100644
--- a/testasmcomp/quicksort2.cmm
+++ b/testasmcomp/quicksort2.cmm
@@ -18,28 +18,28 @@
(if (< lo hi)
(let (i lo
j hi
- pivot (addraref a hi))
+ pivot (intaref a hi))
(while (< i j)
(catch
(while 1
(if (>= i hi) exit [])
- (if (> (app cmp [(addraref a i) pivot] int) 0) exit [])
+ (if (> (app cmp [(intaref a i) pivot] int) 0) exit [])
(assign i (+ i 1)))
with [])
(catch
(while 1
(if (<= j lo) exit [])
- (if (< (app cmp [(addraref a j) pivot] int) 0) exit [])
+ (if (< (app cmp [(intaref a j) pivot] int) 0) exit [])
(assign j (- j 1)))
with [])
(if (< i j)
- (let temp (addraref a i)
- (addraset a i (addraref a j))
- (addraset a j temp))
+ (let temp (intaref a i)
+ (intaset a i (intaref a j))
+ (intaset a j temp))
[]))
- (let temp (addraref a i)
- (addraset a i (addraref a hi))
- (addraset a hi temp))
+ (let temp (intaref a i)
+ (intaset a i (intaref a hi))
+ (intaset a hi temp))
(app "quick" [lo (- i 1) a cmp] unit)
(app "quick" [(+ i 1) hi a cmp] unit))
[]))