Skip to content

Commit

Permalink
Some 68060 tests:
Browse files Browse the repository at this point in the history
- 060sp is calling glue to Motorolas test code for the 68060SP. We dont call
  the ftest #3, as it requires special kernel support not wanted normally.
- emuspeed is a partially table-driven instruction, thus easily extensible
  benchmark. Tests are in for the emulated-on-68060 mul 32->64bit and
  div 64->32bit.
  • Loading branch information
is committed Sep 30, 1997
1 parent a2bca40 commit 34a3b6c
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 0 deletions.
23 changes: 23 additions & 0 deletions regress/sys/arch/m68k/060sp/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# $NetBSD: Makefile,v 1.1.1.1 1997/09/30 23:12:45 is Exp $

NOMAN=notyet
PROG=dotest
SRCS=dotest.c dotestsubs.S
AFLAGS+=-I.
CFLAGS+=-I.
SPDIR=${.CURDIR}/../../../../../sys/arch/m68k/060sp
CLEANFILES+=itest.S ftest.S

.SUFFIXES: .S .sa

.sa.S: ; sh ${SPDIR}/asm2gas ${.IMPSRC} >${.TARGET}

.PATH: ${SPDIR}

depend dotestsubs.o: itest.S ftest.S

regress: ${PROG}
@./${PROG} | tee /dev/tty | cmp -s - ${.CURDIR}/goodoutput


.include <bsd.prog.mk>
40 changes: 40 additions & 0 deletions regress/sys/arch/m68k/060sp/dotest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <stdio.h>

void print_str(const char *s);
void print_num(const int);
void itest(void);
void ftest1(void);
void ftest2(void);
void ftest3(void);

void
print_str(s)
const char *s;
{
printf("%s", s);
fflush(stdout);
}

void
print_num(i)
int i;
{
printf("%d", i);
fflush(stdout);
}

int
main()
{
itest();
ftest1();
ftest2();
#if 0
/*
* We would need a special kernel, that clears the exception condition
* and does RTE, to run this.
*/
ftest3();
#endif
exit (0);
}
27 changes: 27 additions & 0 deletions regress/sys/arch/m68k/060sp/dotestsubs.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.globl _print_str,_print_num

Lprint_str: jmp _print_str
Lprint_num: jmp _print_num

_060FPSP_TEST:
.long Lprint_str - _060FPSP_TEST
.long Lprint_num - _060FPSP_TEST
.space 120
#include "ftest.S"

_060ISP_TEST:
.long Lprint_str - _060ISP_TEST
.long Lprint_num - _060ISP_TEST
.space 120
#include "itest.S"

.globl _itest,_ftest1,_ftest2,_ftest3
_itest:
bra _060ISP_TEST+128+0
_ftest1:
bra _060FPSP_TEST+128+0
_ftest2:
bra _060FPSP_TEST+128+8
_ftest3:
bra _060FPSP_TEST+128+16

15 changes: 15 additions & 0 deletions regress/sys/arch/m68k/060sp/goodoutput
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Testing 68060 ISP started:
64-bit multiply...passed
64-bit divide...passed
cmp2,chk2...passed
movep...passed
Effective addresses...passed
cas...passed
cas2...passed
Testing 68060 FPSP started:
Unimplemented <ea>...passed
Unimplemented data type/format...passed
Non-maskable overflow...passed
Non-maskable underflow...passed
Testing 68060 FPSP unimplemented instruction started:
Unimplemented FP instructions...passed
3 changes: 3 additions & 0 deletions regress/sys/arch/m68k/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUBDIR+=060sp emuspeed

.include <bsd.subdir.mk>
12 changes: 12 additions & 0 deletions regress/sys/arch/m68k/emuspeed/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
15 changes: 15 additions & 0 deletions regress/sys/arch/m68k/emuspeed/compare
Original file line number Diff line number Diff line change
@@ -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 "

50 changes: 50 additions & 0 deletions regress/sys/arch/m68k/emuspeed/div64.s
Original file line number Diff line number Diff line change
@@ -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
75 changes: 75 additions & 0 deletions regress/sys/arch/m68k/emuspeed/emuspeed.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>

#include "speed.h"

const struct test {
char *name;
void (*func)__P((int));
char *comment;
int count;
} testlist[] = {
{"Illegal", illegal, "(test: unimplemented)", 1},
{"mulsl Da,Db", mul32sreg, "(test: should be native)", 200000000},
{"mulsl sp@(8),Da", mul32smem, "(test: should be native)\n",
200000000},

{"mulsl Dn,Da:Db", mul64sreg, "emulated on 68060", 2000000},
{"mulul Dn,Da:Db", mul64ureg, "\t\"", 2000000},
{"mulsl sp@(8),Da:Db", mul64smem, "\t\"", 1000000},
{"mulul sp@(8),Da:Db", mul64umem, "\t\"\n", 1000000},

{"divsl Da:Db,Dn", div64sreg, "\t\"", 500000},
{"divul Da:Db,Dn", div64ureg, "\t\"", 500000},
{"divsl Da:Db,sp@(8)", div64smem, "\t\"", 300000},
{"divul Da:Db,sp@(8)", div64umem, "\t\"\n", 300000},

{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;


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;
}

start = clock();
t->func(t->count);
stop = clock();
printf("%13d/s %s\n",
CLOCKS_PER_SEC*(t->count /(stop - start)),
t->comment);
}
exit (0);
}

void
illhand(int i)
{
longjmp(jbuf, 1);
}
15 changes: 15 additions & 0 deletions regress/sys/arch/m68k/emuspeed/midtimes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Speed of instructions which are emulated on some cpus:

Illegal [unimplemented] (test: unimplemented)
mulsl sp@(8),Da 6211100/s (test: should be native)

mulsl Dn,Da:Db 184300/s emulated on 68060
mulul Dn,Da:Db 183300/s "
mulsl sp@(8),Da:Db 117300/s "
mulul sp@(8),Da:Db 117500/s "

divsl Da:Db,Dn 103700/s "
divul Da:Db,Dn 66700/s "
divsl Da:Db,sp@(8) 51400/s "
divul Da:Db,sp@(8) 53100/s "

50 changes: 50 additions & 0 deletions regress/sys/arch/m68k/emuspeed/mul64.s
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions regress/sys/arch/m68k/emuspeed/speed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#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));
26 changes: 26 additions & 0 deletions regress/sys/arch/m68k/emuspeed/test.s
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 34a3b6c

Please sign in to comment.