Skip to content

Commit c6ab74e

Browse files
authored
Merge pull request 86Box#5266 from Cacodemon345/fpu-reverts
Revert all FPU changes for Final Reality
2 parents 80159bc + 23b89d8 commit c6ab74e

File tree

6 files changed

+0
-116
lines changed

6 files changed

+0
-116
lines changed

src/codegen/codegen_ops_x86-64.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,8 +3571,6 @@ FP_FLD(int reg)
35713571
addbyte(0x89); /*MOV [TOP], EBX*/
35723572
addbyte(0x5d);
35733573
addbyte((uint8_t) cpu_state_offset(TOP));
3574-
3575-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
35763574
}
35773575

35783576
static __inline void
@@ -3690,8 +3688,6 @@ FP_LOAD_S(void)
36903688
addbyte(0x44);
36913689
addbyte(0x1d);
36923690
addbyte((uint8_t) cpu_state_offset(tag));
3693-
3694-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
36953691
}
36963692
static __inline void
36973693
FP_LOAD_D(void)
@@ -3721,8 +3717,6 @@ FP_LOAD_D(void)
37213717
addbyte(0x44);
37223718
addbyte(0x1d);
37233719
addbyte((uint8_t) cpu_state_offset(tag));
3724-
3725-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
37263720
}
37273721

37283722
static __inline void
@@ -3760,8 +3754,6 @@ FP_LOAD_IW(void)
37603754
addbyte(0x44);
37613755
addbyte(0x1d);
37623756
addbyte((uint8_t) cpu_state_offset(tag));
3763-
3764-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
37653757
}
37663758
static __inline void
37673759
FP_LOAD_IL(void)
@@ -3795,8 +3787,6 @@ FP_LOAD_IL(void)
37953787
addbyte(0x44);
37963788
addbyte(0x1d);
37973789
addbyte((uint8_t) cpu_state_offset(tag));
3798-
3799-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
38003790
}
38013791
static __inline void
38023792
FP_LOAD_IQ(void)
@@ -3841,8 +3831,6 @@ FP_LOAD_IQ(void)
38413831
addbyte(0x44);
38423832
addbyte(0x1d);
38433833
addbyte((uint8_t) cpu_state_offset(tag));
3844-
3845-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
38463834
}
38473835

38483836
static __inline void
@@ -3875,8 +3863,6 @@ FP_LOAD_IMM_Q(uint64_t v)
38753863
addbyte(0x1d);
38763864
addbyte((uint8_t) cpu_state_offset(tag));
38773865
addbyte(v ? 0 : 1);
3878-
3879-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
38803866
}
38813867

38823868
static __inline void

src/codegen/codegen_ops_x86.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,6 @@ FP_FLD(int reg)
17941794
addbyte(0x5d);
17951795
addbyte((uint8_t) cpu_state_offset(TOP));
17961796
}
1797-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
17981797
}
17991798

18001799
static __inline void
@@ -2038,7 +2037,6 @@ FP_LOAD_S(void)
20382037
addbyte(0x1d);
20392038
addbyte((uint8_t) cpu_state_offset(tag[0]));
20402039
}
2041-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
20422040
}
20432041
static __inline void
20442042
FP_LOAD_D(void)
@@ -2098,7 +2096,6 @@ FP_LOAD_D(void)
20982096
addbyte(0x1d);
20992097
addbyte((uint8_t) cpu_state_offset(tag[0]));
21002098
}
2101-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
21022099
}
21032100
static __inline void
21042101
FP_LOAD_IW(void)
@@ -2157,7 +2154,6 @@ FP_LOAD_IW(void)
21572154
addbyte(0x1d);
21582155
addbyte((uint8_t) cpu_state_offset(tag[0]));
21592156
}
2160-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
21612157
}
21622158
static __inline void
21632159
FP_LOAD_IL(void)
@@ -2214,7 +2210,6 @@ FP_LOAD_IL(void)
22142210
addbyte(0x1d);
22152211
addbyte((uint8_t) cpu_state_offset(tag[0]));
22162212
}
2217-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
22182213
}
22192214
static __inline void
22202215
FP_LOAD_IQ(void)
@@ -2290,7 +2285,6 @@ FP_LOAD_IQ(void)
22902285
addbyte(0x1d);
22912286
addbyte((uint8_t) cpu_state_offset(tag[0]));
22922287
}
2293-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
22942288
}
22952289

22962290
static __inline void
@@ -2342,7 +2336,6 @@ FP_LOAD_IMM_Q(uint64_t v)
23422336
addbyte(0x5d);
23432337
addbyte((uint8_t) cpu_state_offset(TOP));
23442338
}
2345-
CALL_FUNC((uintptr_t) x87_to_mmxreg);
23462339
}
23472340

23482341
static __inline int

src/codegen_new/codegen_ops_helpers.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ fpu_POP2(codeblock_t *block, ir_data_t *ir)
6464
static inline void
6565
fpu_PUSH(codeblock_t *block, ir_data_t *ir)
6666
{
67-
uop_LOAD_FUNC_ARG_IMM(ir, 0, ((uint16_t)cpu_state.TOP - 1));
68-
uop_CALL_FUNC(ir, x87_to_mmxreg);
69-
7067
if (block->flags & CODEBLOCK_STATIC_TOP)
7168
uop_MOV_IMM(ir, IREG_FPU_TOP, cpu_state.TOP - 1);
7269
else

src/cpu/386_dynarec.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,6 @@ x386_dynarec_log(const char *fmt, ...)
7474
# define x386_dynarec_log(fmt, ...)
7575
#endif
7676

77-
#if defined(_MSC_VER) && !defined(__clang__)
78-
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
79-
# define X87_INLINE_ASM
80-
# endif
81-
#else
82-
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined _M_X64 || defined __amd64__
83-
# define X87_INLINE_ASM
84-
# endif
85-
#endif
86-
8777
static __inline void
8878
fetch_ea_32_long(uint32_t rmdat)
8979
{
@@ -243,41 +233,6 @@ fetch_ea_16_long(uint32_t rmdat)
243233
# define CACHE_ON() (!(cr0 & (1 << 30)) && !(cpu_state.flags & T_FLAG))
244234
#endif
245235

246-
/* Deliberately stashed here; this function is only relevant for dynamic recompilers. */
247-
#ifdef USE_NEW_DYNAREC
248-
void
249-
x87_to_mmxreg(uint16_t reg)
250-
#else
251-
void
252-
x87_to_mmxreg(void)
253-
#endif
254-
{
255-
#ifndef USE_NEW_DYNAREC
256-
uint32_t reg = cpu_state.TOP & 7;
257-
#endif
258-
double val = cpu_state.ST[reg & 7];
259-
#ifdef X87_INLINE_ASM
260-
unsigned char buffer[10];
261-
#else
262-
x87_conv_t test;
263-
#endif
264-
265-
#ifdef X87_INLINE_ASM
266-
__asm volatile(""
267-
:
268-
:
269-
: "memory");
270-
271-
__asm volatile("fldl %1\n"
272-
"fstpt %0\n" : "=m"(buffer) : "m"(val));
273-
274-
cpu_state.MM[reg & 7].q = (*(uint64_t*)buffer);
275-
#else
276-
x87_to80(val, &test);
277-
cpu_state.MM[reg & 7].q = test.eind.ll;
278-
#endif
279-
}
280-
281236
#ifdef USE_DYNAREC
282237
int32_t cycles_main = 0;
283238
static int32_t cycles_old = 0;

src/cpu/cpu.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -829,12 +829,6 @@ extern uint16_t prefetch_queue_get_ip(void);
829829
extern int prefetch_queue_get_prefetching(void);
830830
extern int prefetch_queue_get_size(void);
831831

832-
#ifdef USE_NEW_DYNAREC
833-
extern void x87_to_mmxreg(uint16_t reg);
834-
#else
835-
extern void x87_to_mmxreg(void);
836-
#endif
837-
838832
#define prefetch_queue_set_suspended(s) prefetch_queue_set_prefetching(!s)
839833
#define prefetch_queue_get_suspended !prefetch_queue_get_prefetching
840834

src/cpu/x87_ops.h

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,12 @@ typedef union {
113113
static __inline void
114114
x87_push(double i)
115115
{
116-
#ifdef X87_INLINE_ASM
117-
unsigned char buffer[10];
118-
#else
119-
x87_conv_t test;
120-
#endif
121116
#ifdef USE_NEW_DYNAREC
122117
cpu_state.TOP--;
123118
#else
124119
cpu_state.TOP = (cpu_state.TOP - 1) & 7;
125120
#endif
126121
cpu_state.ST[cpu_state.TOP & 7] = i;
127-
128-
#ifdef X87_INLINE_ASM
129-
__asm volatile(""
130-
:
131-
:
132-
: "memory");
133-
134-
__asm volatile("fldl %1\n"
135-
"fstpt %0\n" : "=m"(buffer) : "m"(i));
136-
137-
cpu_state.MM[cpu_state.TOP & 7].q = (*(uint64_t*)buffer);
138-
#else
139-
x87_to80(i, &test);
140-
cpu_state.MM[cpu_state.TOP & 7].q = test.eind.ll;
141-
#endif
142-
143122
#ifdef USE_NEW_DYNAREC
144123
cpu_state.tag[cpu_state.TOP & 7] = TAG_VALID;
145124
#else
@@ -150,11 +129,6 @@ x87_push(double i)
150129
static __inline void
151130
x87_push_u64(uint64_t i)
152131
{
153-
#ifdef X87_INLINE_ASM
154-
unsigned char buffer[10];
155-
#else
156-
x87_conv_t test;
157-
#endif
158132
union {
159133
double d;
160134
uint64_t ll;
@@ -168,21 +142,6 @@ x87_push_u64(uint64_t i)
168142
cpu_state.TOP = (cpu_state.TOP - 1) & 7;
169143
#endif
170144
cpu_state.ST[cpu_state.TOP & 7] = td.d;
171-
172-
#ifdef X87_INLINE_ASM
173-
__asm volatile(""
174-
:
175-
:
176-
: "memory");
177-
178-
__asm volatile("fldl %1\n"
179-
"fstpt %0\n" : "=m"(buffer) : "m"(td.d));
180-
181-
cpu_state.MM[cpu_state.TOP & 7].q = (*(uint64_t*)buffer);
182-
#else
183-
x87_to80(td.d, &test);
184-
cpu_state.MM[cpu_state.TOP & 7].q = test.eind.ll;
185-
#endif
186145
#ifdef USE_NEW_DYNAREC
187146
cpu_state.tag[cpu_state.TOP & 7] = TAG_VALID;
188147
#else

0 commit comments

Comments
 (0)