diff options
author | ian <ian@FreeBSD.org> | 2014-05-14 04:42:38 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-05-14 04:42:38 +0000 |
commit | 9277bb1a2b74a398eb2fd572785d2d6db451d8c1 (patch) | |
tree | 1db333efac7875c8cb26cb76df9eecc9a08af919 /sys/powerpc/fpu | |
parent | d168d59495df2455ad00bf4c5663f265523c3691 (diff) | |
download | FreeBSD-src-9277bb1a2b74a398eb2fd572785d2d6db451d8c1.zip FreeBSD-src-9277bb1a2b74a398eb2fd572785d2d6db451d8c1.tar.gz |
MFC r258247, r258250, r258257
Remove a pointless #ifdef AIM. This is just PPC64 specific, including
64-bit Book-E.
Make single precision floating point arithmetic actually work
Split the function of the PCB_FPU flags into two: PCB_FPU now indicates that
the actual FPU is enabled, while PCB_FPREGS indicates that the FPU state
structure in the PCB is valid.
Diffstat (limited to 'sys/powerpc/fpu')
-rw-r--r-- | sys/powerpc/fpu/fpu_emu.c | 15 | ||||
-rw-r--r-- | sys/powerpc/fpu/fpu_explode.c | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/powerpc/fpu/fpu_emu.c b/sys/powerpc/fpu/fpu_emu.c index 8cfc2a3..33c1f74 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); diff --git a/sys/powerpc/fpu/fpu_explode.c b/sys/powerpc/fpu/fpu_explode.c index d2646fc..91d92b3 100644 --- a/sys/powerpc/fpu/fpu_explode.c +++ b/sys/powerpc/fpu/fpu_explode.c @@ -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); } |