From 81a089d4ad784742adb4f13415a7fa26d9b7e504 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Fri, 20 May 2011 15:56:25 -0700 Subject: [pk] fixed FP emulation (rounding mode bug) --- pk/fp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pk') diff --git a/pk/fp.c b/pk/fp.c index 794755d..e1298ad 100644 --- a/pk/fp.c +++ b/pk/fp.c @@ -40,7 +40,7 @@ int emulate_fp(trapframe_t* tf) #define RRS2 ((tf->insn >> 17) & 0x1F) #define RRS3 ((tf->insn >> 12) & 0x1F) #define RRD ((tf->insn >> 27) & 0x1F) - #define RM ((tf->insn >> 9) & 0x3) + #define RM ((tf->insn >> 9) & 0x7) int32_t imm = ((int32_t)tf->insn << 10) >> 20; int32_t bimm = (((tf->insn >> 27) & 0x1f) << 7) | ((tf->insn >> 10) & 0x7f); @@ -61,7 +61,7 @@ int emulate_fp(trapframe_t* tf) long effective_address_store = XRS1 + bimm; softfloat_exceptionFlags = 0; - softfloat_roundingMode = (RM & 4) ? (RM & 3) : ((fp_state.fsr >> 5) & 3); + softfloat_roundingMode = (RM == 7) ? ((fp_state.fsr >> 5) & 7) : RM; #define IS_INSN(x) ((tf->insn & MASK_ ## x) == MATCH_ ## x) -- cgit v1.1