2004-06-18 18:11:11 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2005-03-21 00:19:38 +03:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2004-06-18 18:11:11 +04:00
|
|
|
//
|
2012-08-05 17:52:40 +04:00
|
|
|
// Copyright (c) 2003-2012 Stanislav Shwartsman
|
2007-03-24 00:27:13 +03:00
|
|
|
// Written by Stanislav Shwartsman [sshwarts at sourceforge net]
|
2004-06-18 18:11:11 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-02-08 20:29:34 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-05-12 22:07:48 +04:00
|
|
|
//
|
2004-06-18 18:11:11 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
|
|
|
#include "bochs.h"
|
2006-03-07 01:03:16 +03:00
|
|
|
#include "cpu/cpu.h"
|
2004-06-18 18:11:11 +04:00
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
|
|
|
|
|
|
|
#if BX_SUPPORT_FPU
|
2008-04-05 01:05:37 +04:00
|
|
|
|
2015-05-02 23:08:36 +03:00
|
|
|
float_status_t i387cw_to_softfloat_status_word(Bit16u control_word)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
float_status_t status;
|
|
|
|
|
|
|
|
int precision = control_word & FPU_CW_PC;
|
2008-02-06 01:33:35 +03:00
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
switch(precision)
|
|
|
|
{
|
|
|
|
case FPU_PR_32_BITS:
|
|
|
|
status.float_rounding_precision = 32;
|
|
|
|
break;
|
|
|
|
case FPU_PR_64_BITS:
|
|
|
|
status.float_rounding_precision = 64;
|
|
|
|
break;
|
|
|
|
case FPU_PR_80_BITS:
|
|
|
|
status.float_rounding_precision = 80;
|
|
|
|
break;
|
|
|
|
default:
|
2008-02-06 01:33:35 +03:00
|
|
|
/* With the precision control bits set to 01 "(reserved)", a
|
|
|
|
real CPU behaves as if the precision control bits were
|
2004-06-18 18:11:11 +04:00
|
|
|
set to 11 "80 bits" */
|
|
|
|
status.float_rounding_precision = 80;
|
|
|
|
}
|
|
|
|
|
|
|
|
status.float_exception_flags = 0; // clear exceptions before execution
|
|
|
|
status.float_nan_handling_mode = float_first_operand_nan;
|
|
|
|
status.float_rounding_mode = (control_word & FPU_CW_RC) >> 10;
|
|
|
|
status.flush_underflow_to_zero = 0;
|
2013-12-14 16:45:06 +04:00
|
|
|
status.float_suppress_exception = 0;
|
2009-06-05 21:48:55 +04:00
|
|
|
status.float_exception_masks = control_word & FPU_CW_Exceptions_Mask;
|
2011-10-01 19:40:36 +04:00
|
|
|
status.denormals_are_zeros = 0;
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
#include "softfloatx80.h"
|
|
|
|
|
|
|
|
floatx80 FPU_handle_NaN(floatx80 a, int aIsNaN, float32 b32, int bIsNaN, float_status_t &status)
|
|
|
|
{
|
|
|
|
int aIsSignalingNaN = floatx80_is_signaling_nan(a);
|
|
|
|
int bIsSignalingNaN = float32_is_signaling_nan(b32);
|
|
|
|
|
2009-05-19 12:09:15 +04:00
|
|
|
if (aIsSignalingNaN | bIsSignalingNaN)
|
|
|
|
float_raise(status, float_flag_invalid);
|
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
// propogate QNaN to SNaN
|
|
|
|
a = propagateFloatx80NaN(a, status);
|
|
|
|
|
2009-05-19 12:09:15 +04:00
|
|
|
if (aIsNaN & !bIsNaN) return a;
|
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
// float32 is NaN so conversion will propagate SNaN to QNaN and raise
|
|
|
|
// appropriate exception flags
|
|
|
|
floatx80 b = float32_to_floatx80(b32, status);
|
|
|
|
|
|
|
|
if (aIsSignalingNaN) {
|
|
|
|
if (bIsSignalingNaN) goto returnLargerSignificand;
|
|
|
|
return bIsNaN ? b : a;
|
|
|
|
}
|
|
|
|
else if (aIsNaN) {
|
2009-05-19 12:09:15 +04:00
|
|
|
if (bIsSignalingNaN) return a;
|
2009-04-23 09:16:29 +04:00
|
|
|
returnLargerSignificand:
|
|
|
|
if (a.fraction < b.fraction) return b;
|
|
|
|
if (b.fraction < a.fraction) return a;
|
|
|
|
return (a.exp < b.exp) ? a : b;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int FPU_handle_NaN(floatx80 a, float32 b, floatx80 &r, float_status_t &status)
|
|
|
|
{
|
|
|
|
if (floatx80_is_unsupported(a)) {
|
|
|
|
float_raise(status, float_flag_invalid);
|
|
|
|
r = floatx80_default_nan;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int aIsNaN = floatx80_is_nan(a), bIsNaN = float32_is_nan(b);
|
|
|
|
if (aIsNaN | bIsNaN) {
|
|
|
|
r = FPU_handle_NaN(a, aIsNaN, b, bIsNaN, status);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 FPU_handle_NaN(floatx80 a, int aIsNaN, float64 b64, int bIsNaN, float_status_t &status)
|
|
|
|
{
|
|
|
|
int aIsSignalingNaN = floatx80_is_signaling_nan(a);
|
|
|
|
int bIsSignalingNaN = float64_is_signaling_nan(b64);
|
|
|
|
|
2009-05-19 12:09:15 +04:00
|
|
|
if (aIsSignalingNaN | bIsSignalingNaN)
|
|
|
|
float_raise(status, float_flag_invalid);
|
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
// propogate QNaN to SNaN
|
|
|
|
a = propagateFloatx80NaN(a, status);
|
|
|
|
|
2009-05-19 12:09:15 +04:00
|
|
|
if (aIsNaN & !bIsNaN) return a;
|
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
// float64 is NaN so conversion will propagate SNaN to QNaN and raise
|
|
|
|
// appropriate exception flags
|
|
|
|
floatx80 b = float64_to_floatx80(b64, status);
|
|
|
|
|
|
|
|
if (aIsSignalingNaN) {
|
|
|
|
if (bIsSignalingNaN) goto returnLargerSignificand;
|
|
|
|
return bIsNaN ? b : a;
|
|
|
|
}
|
|
|
|
else if (aIsNaN) {
|
2009-05-19 12:09:15 +04:00
|
|
|
if (bIsSignalingNaN) return a;
|
2009-04-23 09:16:29 +04:00
|
|
|
returnLargerSignificand:
|
|
|
|
if (a.fraction < b.fraction) return b;
|
|
|
|
if (b.fraction < a.fraction) return a;
|
|
|
|
return (a.exp < b.exp) ? a : b;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int FPU_handle_NaN(floatx80 a, float64 b, floatx80 &r, float_status_t &status)
|
|
|
|
{
|
|
|
|
if (floatx80_is_unsupported(a)) {
|
|
|
|
float_raise(status, float_flag_invalid);
|
|
|
|
r = floatx80_default_nan;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int aIsNaN = floatx80_is_nan(a), bIsNaN = float64_is_nan(b);
|
|
|
|
if (aIsNaN | bIsNaN) {
|
|
|
|
r = FPU_handle_NaN(a, aIsNaN, b, bIsNaN, status);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FADD_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2015-05-02 23:08:36 +03:00
|
|
|
float_status_t status =
|
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_add(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FADD_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_add(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FADD_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_add(a, float32_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FADD_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_add(a, float64_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIADD_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_add(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIADD_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80(load_reg);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_add(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FMUL_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_mul(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FMUL_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_mul(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FMUL_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_mul(a, float32_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FMUL_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_mul(a, float64_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIMUL_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_mul(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIMUL_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80(load_reg);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_mul(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUB_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUBR_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUB_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUBR_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUB_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_sub(a, float32_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUBR_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(b, load_reg, result, status))
|
|
|
|
result = floatx80_sub(float32_to_floatx80(load_reg, status), b, status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUB_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_sub(a, float64_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSUBR_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
|
|
|
|
floatx80 b = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(b, load_reg, result, status))
|
|
|
|
result = floatx80_sub(float64_to_floatx80(load_reg, status), b, status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FISUB_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FISUBR_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FISUB_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2011-04-20 21:29:17 +04:00
|
|
|
floatx80 result = floatx80_sub(BX_READ_FPU_REG(0), int32_to_floatx80(load_reg), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FISUBR_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = int32_to_floatx80(load_reg);
|
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sub(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIV_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIVR_ST0_STj(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->src()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->src());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIV_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIVR_STi_ST0(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
int pop_stack = i->b1() & 2;
|
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
2012-08-05 17:52:40 +04:00
|
|
|
if (IS_TAG_EMPTY(0) || IS_TAG_EMPTY(i->dst()))
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
2012-08-05 17:52:40 +04:00
|
|
|
FPU_stack_underflow(i->dst(), pop_stack);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
2012-08-05 17:52:40 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(i->dst());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags)) {
|
2012-08-05 17:52:40 +04:00
|
|
|
BX_WRITE_FPU_REG(result, i->dst());
|
2009-03-11 00:43:11 +03:00
|
|
|
if (pop_stack)
|
|
|
|
BX_CPU_THIS_PTR the_i387.FPU_pop();
|
|
|
|
}
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIV_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_div(a, float32_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIVR_SINGLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float32 load_reg = read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(b, load_reg, result, status))
|
|
|
|
result = floatx80_div(float32_to_floatx80(load_reg, status), b, status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIV_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 a = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(a, load_reg, result, status))
|
|
|
|
result = floatx80_div(a, float64_to_floatx80(load_reg, status), status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FDIVR_DOUBLE_REAL(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
float64 load_reg = read_virtual_qword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-04-23 09:16:29 +04:00
|
|
|
floatx80 b = BX_READ_FPU_REG(0), result;
|
|
|
|
if (! FPU_handle_NaN(b, load_reg, result, status))
|
|
|
|
result = floatx80_div(float64_to_floatx80(load_reg, status), b, status);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIDIV_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIDIVR_WORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit16s load_reg = (Bit16s) read_virtual_word(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = int32_to_floatx80((Bit32s)(load_reg));
|
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIDIV_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = BX_READ_FPU_REG(0);
|
|
|
|
floatx80 b = int32_to_floatx80(load_reg);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FIDIVR_DWORD_INTEGER(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
RMAddr(i) = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
|
2008-04-26 23:38:53 +04:00
|
|
|
Bit32s load_reg = (Bit32s) read_virtual_dword(i->seg(), RMAddr(i));
|
|
|
|
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
|
|
|
|
2004-06-18 18:11:11 +04:00
|
|
|
clear_C1();
|
|
|
|
|
2008-04-26 23:38:53 +04:00
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
floatx80 a = int32_to_floatx80(load_reg);
|
|
|
|
floatx80 b = BX_READ_FPU_REG(0);
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_div(a, b, status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FSQRT(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_sqrt(BX_READ_FPU_REG(0), status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* D9 FC */
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_INSF_TYPE BX_CPP_AttrRegparmN(1) BX_CPU_C::FRNDINT(bxInstruction_c *i)
|
2004-06-18 18:11:11 +04:00
|
|
|
{
|
|
|
|
BX_CPU_THIS_PTR prepareFPU(i);
|
2009-04-27 18:00:55 +04:00
|
|
|
BX_CPU_THIS_PTR FPU_update_last_instruction(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
clear_C1();
|
|
|
|
|
|
|
|
if (IS_TAG_EMPTY(0)) {
|
2009-05-28 23:25:33 +04:00
|
|
|
FPU_stack_underflow(0);
|
2011-07-07 00:01:18 +04:00
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:33:35 +03:00
|
|
|
float_status_t status =
|
2015-05-02 23:08:36 +03:00
|
|
|
i387cw_to_softfloat_status_word(BX_CPU_THIS_PTR the_i387.get_control_word());
|
2004-06-18 18:11:11 +04:00
|
|
|
|
|
|
|
floatx80 result = floatx80_round_to_int(BX_READ_FPU_REG(0), status);
|
|
|
|
|
2009-05-28 23:25:33 +04:00
|
|
|
if (! FPU_exception(status.float_exception_flags))
|
2009-03-11 00:43:11 +03:00
|
|
|
BX_WRITE_FPU_REG(result, 0);
|
2011-07-07 00:01:18 +04:00
|
|
|
|
|
|
|
BX_NEXT_INSTR(i);
|
2004-06-18 18:11:11 +04:00
|
|
|
}
|
2008-04-05 01:05:37 +04:00
|
|
|
|
|
|
|
#endif
|