Add ftwotox emulation, by using the fscale emulation routine (preload

destination register bit pattern with 1.0), which automatically provides
corner case handling.
Missing ftwotox emulation originally reported by Norman Mackenzie in PR 4237,
but he proposed a different implementation.
This commit is contained in:
is 1997-11-02 22:02:46 +00:00
parent 8dbb87fe86
commit 2ee51585ba
2 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_emulate.c,v 1.17 1997/07/20 12:39:17 is Exp $ */
/* $NetBSD: fpu_emulate.c,v 1.18 1997/11/02 22:02:46 is Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -212,6 +212,11 @@ fpu_emulate(frame, fpf)
if (fpu_debug_level & DL_INSN)
printf(" fpu_emulate: fscale\n");
sig = fpu_emul_fscale(&fe, &insn);
} else if ((word & 0xa07f) == 0x11) {
/* ftwotox */
if (fpu_debug_level & DL_INSN)
printf(" fpu_emulate: ftwotox\n");
sig = fpu_emul_fscale(&fe, &insn);
} else {
if (fpu_debug_level & DL_INSN)
printf(" fpu_emulte: other type0\n");
@ -801,9 +806,11 @@ fpu_emul_arith(fe, insn)
res = fpu_etox(fe);
break;
#if 0 /* handled by fscale now */
case 0x11: /* ftwotox */
res = fpu_twotox(fe);
break;
#endif
case 0x12: /* ftentox */
res = fpu_tentox(fe);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fpu_fscale.c,v 1.7 1997/10/09 19:19:01 is Exp $ */
/* $NetBSD: fpu_fscale.c,v 1.8 1997/11/02 22:02:47 is Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@ -181,6 +181,15 @@ fpu_emul_fscale(fe, insn)
/* it's barbaric but we're going to operate directly on
* the dst operand's bit pattern */
if ((word1 & 0x7f) == 0x11) {
/* ftwotox: preload reg with 1.0 */
fpregs[regnum * 3 + 0] = 0x3fff0000;
fpregs[regnum * 3 + 1] = 0x80000000;
fpregs[regnum * 3 + 2] = 0x00000000;
fe->fe_f2.fp_class = FPC_NUM;
}
sign = fpregs[regnum * 3] & 0x80000000;
exp = (fpregs[regnum * 3] & 0x7fff0000) >> 16;
m0 = fpregs[regnum * 3 + 1];