summaryrefslogtreecommitdiff
path: root/regress/sys/arch/m68k/emuspeed
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sys/arch/m68k/emuspeed')
-rw-r--r--regress/sys/arch/m68k/emuspeed/Makefile14
-rw-r--r--regress/sys/arch/m68k/emuspeed/compare15
-rw-r--r--regress/sys/arch/m68k/emuspeed/div64.s50
-rw-r--r--regress/sys/arch/m68k/emuspeed/emuspeed.c82
-rw-r--r--regress/sys/arch/m68k/emuspeed/mul64.s50
-rw-r--r--regress/sys/arch/m68k/emuspeed/speed.h17
-rw-r--r--regress/sys/arch/m68k/emuspeed/test.s26
7 files changed, 254 insertions, 0 deletions
diff --git a/regress/sys/arch/m68k/emuspeed/Makefile b/regress/sys/arch/m68k/emuspeed/Makefile
new file mode 100644
index 00000000000..c96d564339a
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/Makefile
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.2 1998/01/09 08:03:55 perry Exp $
+#
+PROG=emuspeed
+NOMAN=none
+
+SRCS=emuspeed.c test.s mul64.s div64.s # movepto.c movepfrom.c
+
+/* don't install: */
+proginstall:
+
+.include <bsd.prog.mk>
+
+regress: all
+ @./emuspeed
diff --git a/regress/sys/arch/m68k/emuspeed/compare b/regress/sys/arch/m68k/emuspeed/compare
new file mode 100644
index 00000000000..5e24743fa4c
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/compare
@@ -0,0 +1,15 @@
+Speed of instructions which are emulated on some cpus:
+
+Illegal [unimplemented] (test: unimplemented)
+mulsl sp@(8),Da 18181800/s (test: should be native)
+
+mulsl Dn,Da:Db 185300/s emulated on 68060
+mulul Dn,Da:Db 184300/s "
+mulsl sp@(8),Da:Db 99600/s "
+mulul sp@(8),Da:Db 98900/s "
+
+divsl Da:Db,Dn 162400/s "
+divul Da:Db,Dn 111500/s "
+divsl Da:Db,sp@(8) 58900/s "
+divul Da:Db,sp@(8) 59700/s "
+
diff --git a/regress/sys/arch/m68k/emuspeed/div64.s b/regress/sys/arch/m68k/emuspeed/div64.s
new file mode 100644
index 00000000000..b75235a492f
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/div64.s
@@ -0,0 +1,50 @@
+/*
+ * stack:
+ * + 8: count
+ * + 4: retads
+ * + 0: d2
+ */
+
+ .globl _div64ureg
+_div64ureg:
+ movl d2,sp@-
+ movl sp@(8),d2
+L1:
+ divul d2,d1:d0
+ subql #1,d2
+ jne L1
+ movl sp@+,d2
+ rts
+
+ .globl _div64sreg
+_div64sreg:
+ movl d2,sp@-
+ movl sp@(8),d2
+L2:
+ divsl d2,d1:d0
+ subql #1,d2
+ jne L2
+ movl sp@+,d2
+ rts
+
+ .globl _div64umem
+_div64umem:
+ movl d2,sp@-
+ movl sp@(8),d2
+L3:
+ divul sp@(8),d1:d0
+ subql #1,d2
+ jne L3
+ movl sp@+,d2
+ rts
+
+ .globl _div64smem
+_div64smem:
+ movl d2,sp@-
+ movl sp@(8),d2
+L4:
+ divsl sp@(8),d1:d0
+ subql #1,d2
+ jne L4
+ movl sp@+,d2
+ rts
diff --git a/regress/sys/arch/m68k/emuspeed/emuspeed.c b/regress/sys/arch/m68k/emuspeed/emuspeed.c
new file mode 100644
index 00000000000..092ec595be7
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/emuspeed.c
@@ -0,0 +1,82 @@
+/* $NetBSD: emuspeed.c,v 1.3 1998/06/15 14:43:25 is Exp $ */
+
+#include <setjmp.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "speed.h"
+
+#define PRECISION 500
+
+const struct test {
+ char *name;
+ void (*func)__P((int));
+ char *comment;
+} testlist[] = {
+ {"Illegal", illegal, "(test: unimplemented)"},
+ {"mulsl Da,Db", mul32sreg, "(test: should be native)"},
+ {"mulsl sp@(8),Da", mul32smem, "(test: should be native)\n"},
+
+ {"mulsl Dn,Da:Db", mul64sreg, "emulated on 68060"},
+ {"mulul Dn,Da:Db", mul64ureg, "\t\""},
+ {"mulsl sp@(8),Da:Db", mul64smem, "\t\""},
+ {"mulul sp@(8),Da:Db", mul64umem, "\t\"\n"},
+
+ {"divsl Da:Db,Dn", div64sreg, "\t\""},
+ {"divul Da:Db,Dn", div64ureg, "\t\""},
+ {"divsl Da:Db,sp@(8)", div64smem, "\t\""},
+ {"divul Da:Db,sp@(8)", div64umem, "\t\"\n"},
+
+ {NULL, NULL, NULL}
+};
+
+jmp_buf jbuf;
+void illhand (int);
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ const struct test *t;
+ clock_t start, stop;
+ int count;
+
+
+ if (signal(SIGILL, &illhand))
+ warn("%s: can't install illegal instruction handler.",
+ argv[0]);
+
+ printf("Speed of instructions which are emulated on some cpus:\n\n");
+ (void)sleep(1);
+ for (t=testlist; t->name; t++) {
+ printf("%-20s", t->name);
+ fflush(stdout);
+
+ if (setjmp(jbuf)) {
+ printf("%15s %s\n", "[unimplemented]", t->comment);
+ continue;
+ }
+
+ count = 1000;
+ do {
+ count *= 2;
+ start = clock();
+ t->func(count);
+ stop = clock();
+ } while ((stop - start) < PRECISION);
+ printf("%13d/s %s\n",
+ CLOCKS_PER_SEC*(count /(stop - start)),
+ t->comment);
+ }
+ exit (0);
+}
+
+void
+illhand(int i)
+{
+ longjmp(jbuf, 1);
+}
diff --git a/regress/sys/arch/m68k/emuspeed/mul64.s b/regress/sys/arch/m68k/emuspeed/mul64.s
new file mode 100644
index 00000000000..1586b423b58
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/mul64.s
@@ -0,0 +1,50 @@
+/*
+ * stack:
+ * + 8: count
+ * + 4: retads
+ * + 0: d2
+ */
+
+ .globl _mul64ureg
+_mul64ureg:
+ movl d2,sp@-
+ movl sp@(8),d2
+L1:
+ mulul d2,d1:d0
+ subql #1,d2
+ jne L1
+ movl sp@+,d2
+ rts
+
+ .globl _mul64sreg
+_mul64sreg:
+ movl d2,sp@-
+ movl sp@(8),d2
+L2:
+ mulsl d2,d1:d0
+ subql #1,d2
+ jne L2
+ movl sp@+,d2
+ rts
+
+ .globl _mul64umem
+_mul64umem:
+ movl d2,sp@-
+ movl sp@(8),d2
+L3:
+ mulul sp@(8),d1:d0
+ subql #1,d2
+ jne L3
+ movl sp@+,d2
+ rts
+
+ .globl _mul64smem
+_mul64smem:
+ movl d2,sp@-
+ movl sp@(8),d2
+L4:
+ mulsl sp@(8),d1:d0
+ subql #1,d2
+ jne L4
+ movl sp@+,d2
+ rts
diff --git a/regress/sys/arch/m68k/emuspeed/speed.h b/regress/sys/arch/m68k/emuspeed/speed.h
new file mode 100644
index 00000000000..205b143d0f5
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/speed.h
@@ -0,0 +1,17 @@
+/* $NetBSD: speed.h,v 1.2 1998/01/09 08:03:57 perry Exp $ */
+
+#include <sys/cdefs.h>
+
+void illegal __P((int));
+void mul32smem __P((int));
+void mul32sreg __P((int));
+
+void mul64sreg __P((int));
+void mul64ureg __P((int));
+void mul64smem __P((int));
+void mul64umem __P((int));
+
+void div64umem __P((int));
+void div64smem __P((int));
+void div64ureg __P((int));
+void div64sreg __P((int));
diff --git a/regress/sys/arch/m68k/emuspeed/test.s b/regress/sys/arch/m68k/emuspeed/test.s
new file mode 100644
index 00000000000..7c91f4f58f5
--- /dev/null
+++ b/regress/sys/arch/m68k/emuspeed/test.s
@@ -0,0 +1,26 @@
+ .globl _mul32smem
+_mul32smem:
+ movl d2,sp@-
+ movl sp@(8),d2
+L1:
+ mulsl sp@(8),d1
+ subql #1,d2
+ jne L1
+ movl sp@+,d2
+ rts
+
+ .globl _mul32sreg
+_mul32sreg:
+ movl d2,sp@-
+ movl sp@(8),d2
+L2:
+ mulsl d0,d1
+ subql #1,d2
+ jne L2
+ movl sp@+,d2
+ rts
+
+ .globl _illegal
+_illegal:
+ illegal
+ rts