From 566a7aa82bb27e17c1557cd03679353b00f841da Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Thu, 30 Mar 2017 22:11:38 +0000 Subject: [PATCH] fixed softfloat FUZ condition. fixed/optimized pmaddwd computing function --- bochs/cpu/fpu/softfloat.cc | 4 ++-- bochs/cpu/simd_int.h | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/bochs/cpu/fpu/softfloat.cc b/bochs/cpu/fpu/softfloat.cc index c5c2a8e7e..8287f9ca9 100644 --- a/bochs/cpu/fpu/softfloat.cc +++ b/bochs/cpu/fpu/softfloat.cc @@ -883,7 +883,7 @@ static float32 addFloat32Sigs(float32 a, float32 b, int zSign, float_status_t &s zSig = (aSig + bSig) >> 6; if (aSig | bSig) { float_raise(status, float_flag_denormal); - if (get_flush_underflow_to_zero(status)) { + if (get_flush_underflow_to_zero(status) && (extractFloat32Frac(zSig) == zSig)) { float_raise(status, float_flag_underflow | float_flag_inexact); return packFloat32(zSign, 0, 0); } @@ -2109,7 +2109,7 @@ static float64 addFloat64Sigs(float64 a, float64 b, int zSign, float_status_t &s zSig = (aSig + bSig) >> 9; if (aSig | bSig) { float_raise(status, float_flag_denormal); - if (get_flush_underflow_to_zero(status)) { + if (get_flush_underflow_to_zero(status) && (extractFloat64Frac(zSig) == zSig)) { float_raise(status, float_flag_underflow | float_flag_inexact); return packFloat64(zSign, 0, 0); } diff --git a/bochs/cpu/simd_int.h b/bochs/cpu/simd_int.h index 41268010a..43e89b2af 100644 --- a/bochs/cpu/simd_int.h +++ b/bochs/cpu/simd_int.h @@ -1009,13 +1009,8 @@ BX_CPP_INLINE void xmm_pmaddwd(BxPackedXmmRegister *op1, const BxPackedXmmRegist { for(unsigned n=0; n<4; n++) { - if((op1->xmm32u(n) & op2->xmm32u(n)) == 0x80008000) { - op1->xmm32u(n) = 0x80000000; - } - else { - op1->xmm32u(n) = Bit32s(op1->xmm16s(n*2)) * Bit32s(op2->xmm16s(n*2)) + - Bit32s(op1->xmm16s(n*2+1)) * Bit32s(op2->xmm16s(n*2+1)); - } + op1->xmm32u(n) = Bit32s(op1->xmm16s(n*2)) * Bit32s(op2->xmm16s(n*2)) + + Bit32s(op1->xmm16s(n*2+1)) * Bit32s(op2->xmm16s(n*2+1)); } }