mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-01 15:06:12 +00:00
Avoid the use of floating-point when loading/storing from/to memory. This
could have caused some rounding thus alterations to integer registers on context switches when lfd/stfd instructions were used. e.g. cygwin compilers defaulted to i686 code generation and exhibed this behaviour, you could also see this behavior with -march=i586 -mtune=pentiumpro. GCC is perfectly right to do those optimizations.
This commit is contained in:
parent
1fb076bc7b
commit
0db0d48bf0
@ -171,7 +171,7 @@ void OPPROTO op_load_F##REG##_FPR##N(void) \
|
||||
} \
|
||||
void OPPROTO op_store_F##REG##_FPR##N(void) \
|
||||
{ \
|
||||
CPU->fpr(N) = F##REG; \
|
||||
CPU->fpr_dw(N) = F##REG##_dw; \
|
||||
}
|
||||
#define DEFINE_REG(N) \
|
||||
DEFINE_OP(0,N); \
|
||||
@ -179,7 +179,7 @@ DEFINE_OP(1,N); \
|
||||
DEFINE_OP(2,N); \
|
||||
void OPPROTO op_store_FD_FPR##N(void) \
|
||||
{ \
|
||||
CPU->fpr(N) = FD; \
|
||||
CPU->fpr_dw(N) = FD_dw; \
|
||||
}
|
||||
|
||||
DEFINE_REG(0);
|
||||
@ -423,9 +423,6 @@ void OPPROTO op_mtcrf_T0_im(void)
|
||||
#ifndef do_fsub
|
||||
#define do_fsub(x, y) (x) - (y)
|
||||
#endif
|
||||
#ifndef do_fmov
|
||||
#define do_fmov(x) (x)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@ -438,15 +435,15 @@ void OPPROTO op_##NAME(void) \
|
||||
CODE; \
|
||||
}
|
||||
|
||||
DEFINE_OP(fmov_F0_F1, F0 = F1);
|
||||
DEFINE_OP(fmov_F0_F2, F0 = F2);
|
||||
DEFINE_OP(fmov_F1_F0, F1 = F0);
|
||||
DEFINE_OP(fmov_F1_F2, F1 = F2);
|
||||
DEFINE_OP(fmov_F2_F0, F2 = F0);
|
||||
DEFINE_OP(fmov_F2_F1, F2 = F1);
|
||||
DEFINE_OP(fmov_FD_F0, FD = F0);
|
||||
DEFINE_OP(fmov_FD_F1, FD = F1);
|
||||
DEFINE_OP(fmov_FD_F2, FD = F2);
|
||||
DEFINE_OP(fmov_F0_F1, F0_dw = F1_dw);
|
||||
DEFINE_OP(fmov_F0_F2, F0_dw = F2_dw);
|
||||
DEFINE_OP(fmov_F1_F0, F1_dw = F0_dw);
|
||||
DEFINE_OP(fmov_F1_F2, F1_dw = F2_dw);
|
||||
DEFINE_OP(fmov_F2_F0, F2_dw = F0_dw);
|
||||
DEFINE_OP(fmov_F2_F1, F2_dw = F1_dw);
|
||||
DEFINE_OP(fmov_FD_F0, FD_dw = F0_dw);
|
||||
DEFINE_OP(fmov_FD_F1, FD_dw = F1_dw);
|
||||
DEFINE_OP(fmov_FD_F2, FD_dw = F2_dw);
|
||||
|
||||
DEFINE_OP(fabs_FD_F0, FD = do_fabs(F0));
|
||||
DEFINE_OP(fneg_FD_F0, FD = do_fneg(F0));
|
||||
|
@ -37,12 +37,6 @@
|
||||
#include "mon_disass.h"
|
||||
#endif
|
||||
|
||||
// Disable dynamic translation for floating-point load/store of doubles?
|
||||
// XXX: could this due to some rounding while processing these?
|
||||
#ifdef _WIN32
|
||||
#define DISABLE_FP_DOUBLE_LOAD_STORE 1
|
||||
#endif
|
||||
|
||||
// Define to enable const branches optimization
|
||||
#define FOLLOW_CONST_JUMPS 1
|
||||
|
||||
@ -1109,7 +1103,6 @@ powerpc_cpu::compile_block(uint32 entry_point)
|
||||
dg.gen_store_T0_crf(crfD_field::extract(opcode));
|
||||
break;
|
||||
}
|
||||
#ifndef DISABLE_FP_DOUBLE_LOAD_STORE
|
||||
case PPC_I(LFD): // Load Floating-Point Double
|
||||
op.mem.size = 8;
|
||||
op.mem.do_update = 0;
|
||||
@ -1130,7 +1123,6 @@ powerpc_cpu::compile_block(uint32 entry_point)
|
||||
op.mem.do_update = 0;
|
||||
op.mem.do_indexed = 1;
|
||||
goto do_fp_load;
|
||||
#endif
|
||||
case PPC_I(LFS): // Load Floating-Point Single
|
||||
op.mem.size = 4;
|
||||
op.mem.do_update = 0;
|
||||
@ -1191,7 +1183,6 @@ powerpc_cpu::compile_block(uint32 entry_point)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef DISABLE_FP_DOUBLE_LOAD_STORE
|
||||
case PPC_I(STFD): // Store Floating-Point Double
|
||||
op.mem.size = 8;
|
||||
op.mem.do_update = 0;
|
||||
@ -1212,7 +1203,6 @@ powerpc_cpu::compile_block(uint32 entry_point)
|
||||
op.mem.do_update = 0;
|
||||
op.mem.do_indexed = 1;
|
||||
goto do_fp_store;
|
||||
#endif
|
||||
case PPC_I(STFS): // Store Floating-Point Single
|
||||
op.mem.size = 4;
|
||||
op.mem.do_update = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user