Make single precision floating point arithmetic actually work -- I think

it never did -- and fix an obvious missing line. Floating point emulation
on Book-E still needs some work but this gets it basically functional on
soft-FPU systems (hard FPU for Book-E is not yet implemented).

MFC after:	1 week
This commit is contained in:
Nathan Whitehorn
2013-11-17 05:03:15 +00:00
parent b8b46489f8
commit b8201e1c2c
2 changed files with 13 additions and 3 deletions
+12 -3
View File
@@ -606,9 +606,11 @@ fpu_execute(struct trapframe *tf, struct fpemu *fe, union instr *insn)
rb = instr.i_a.i_frb;
rc = instr.i_a.i_frc;
type = FTYPE_SNG;
if (instr.i_any.i_opcd & 0x4)
type = FTYPE_DBL;
/*
* All arithmetic operations work on registers, which
* are stored as doubles.
*/
type = FTYPE_DBL;
switch ((unsigned int)instr.i_a.i_xo) {
case OPC59_FDIVS:
FPU_EMU_EVCNT_INCR(fdiv);
@@ -725,6 +727,13 @@ fpu_execute(struct trapframe *tf, struct fpemu *fe, union instr *insn)
return (NOTFPU);
break;
}
/* If the instruction was single precision, round */
if (!(instr.i_any.i_opcd & 0x4)) {
fpu_implode(fe, fp, FTYPE_SNG,
(u_int *)&fs->fpreg[rt]);
fpu_explode(fe, fp = &fe->fe_f1, FTYPE_SNG, rt);
}
}
} else {
return (NOTFPU);
+1
View File
@@ -235,6 +235,7 @@ fpu_explode(struct fpemu *fe, struct fpn *fp, int type, int reg)
s = fpu_dtof(fp, s, space[1]);
break;
default:
panic("fpu_explode");
panic("fpu_explode: invalid type %d", type);
}