summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/fpu/fpu_emu.c
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-11-17 05:03:15 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-11-17 05:03:15 +0000
commitdd584b8bb2098094ce462a884d36408579e4e3e5 (patch)
tree1e1805d2858f6290e5a8cd8ddd9bf0f9bca95801 /sys/powerpc/fpu/fpu_emu.c
parent81f8c91220bc2cab187e212c302077ec2abec0e0 (diff)
downloadFreeBSD-src-dd584b8bb2098094ce462a884d36408579e4e3e5.zip
FreeBSD-src-dd584b8bb2098094ce462a884d36408579e4e3e5.tar.gz
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
Diffstat (limited to 'sys/powerpc/fpu/fpu_emu.c')
-rw-r--r--sys/powerpc/fpu/fpu_emu.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/powerpc/fpu/fpu_emu.c b/sys/powerpc/fpu/fpu_emu.c
index 66cc215..49dc758 100644
--- a/sys/powerpc/fpu/fpu_emu.c
+++ b/sys/powerpc/fpu/fpu_emu.c
@@ -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);
OpenPOWER on IntegriCloud