Added initial attempt at instruction timings for 8087/287/387.
Also added 287XL using 387 timings.
This commit is contained in:
parent
0e8926936d
commit
4875f24b53
7 changed files with 153 additions and 124 deletions
|
|
@ -8,7 +8,7 @@ static int opFILDiw_a16(uint32_t fetchdat)
|
|||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", (double)temp);
|
||||
x87_push((double)temp);
|
||||
CLOCK_CYCLES(13);
|
||||
CLOCK_CYCLES(x87_timings.fild_16);
|
||||
return 0;
|
||||
}
|
||||
static int opFILDiw_a32(uint32_t fetchdat)
|
||||
|
|
@ -21,7 +21,7 @@ static int opFILDiw_a32(uint32_t fetchdat)
|
|||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", (double)temp);
|
||||
x87_push((double)temp);
|
||||
CLOCK_CYCLES(13);
|
||||
CLOCK_CYCLES(x87_timings.fild_16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ static int opFISTiw_a16(uint32_t fetchdat)
|
|||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
fatal("FISTw overflow %i\n", temp64);*/
|
||||
seteaw((int16_t)temp64);
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
static int opFISTiw_a32(uint32_t fetchdat)
|
||||
|
|
@ -50,7 +50,7 @@ static int opFISTiw_a32(uint32_t fetchdat)
|
|||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
fatal("FISTw overflow %i\n", temp64);*/
|
||||
seteaw((int16_t)temp64);
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ static int opFISTPiw_a16(uint32_t fetchdat)
|
|||
fatal("FISTw overflow %i\n", temp64);*/
|
||||
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
return 0;
|
||||
}
|
||||
static int opFISTPiw_a32(uint32_t fetchdat)
|
||||
|
|
@ -81,7 +81,7 @@ static int opFISTPiw_a32(uint32_t fetchdat)
|
|||
fatal("FISTw overflow %i\n", temp64);*/
|
||||
seteaw((int16_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_16);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ static int opFILDiq_a16(uint32_t fetchdat)
|
|||
cpu_state.MM[cpu_state.TOP&7].q = temp64;
|
||||
cpu_state.tag[cpu_state.TOP&7] = TAG_VALID | TAG_UINT64;
|
||||
|
||||
CLOCK_CYCLES(10);
|
||||
CLOCK_CYCLES(x87_timings.fild_64);
|
||||
return 0;
|
||||
}
|
||||
static int opFILDiq_a32(uint32_t fetchdat)
|
||||
|
|
@ -114,7 +114,7 @@ static int opFILDiq_a32(uint32_t fetchdat)
|
|||
cpu_state.MM[cpu_state.TOP&7].q = temp64;
|
||||
cpu_state.tag[cpu_state.TOP&7] = TAG_VALID | TAG_UINT64;
|
||||
|
||||
CLOCK_CYCLES(10);
|
||||
CLOCK_CYCLES(x87_timings.fild_64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +143,7 @@ static int FBSTP_a16(uint32_t fetchdat)
|
|||
if (ST(0) < 0.0) tempc |= 0x80;
|
||||
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fbstp);
|
||||
return 0;
|
||||
}
|
||||
static int FBSTP_a32(uint32_t fetchdat)
|
||||
|
|
@ -170,6 +171,7 @@ static int FBSTP_a32(uint32_t fetchdat)
|
|||
if (ST(0) < 0.0) tempc |= 0x80;
|
||||
writememb(easeg, cpu_state.eaaddr + 9, tempc); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(x87_timings.fbstp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +188,7 @@ static int FISTPiq_a16(uint32_t fetchdat)
|
|||
temp64 = x87_fround(ST(0));
|
||||
seteaq(temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_64);
|
||||
return 0;
|
||||
}
|
||||
static int FISTPiq_a32(uint32_t fetchdat)
|
||||
|
|
@ -202,7 +204,7 @@ static int FISTPiq_a32(uint32_t fetchdat)
|
|||
temp64 = x87_fround(ST(0));
|
||||
seteaq(temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(29);
|
||||
CLOCK_CYCLES(x87_timings.fist_64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +218,7 @@ static int opFILDil_a16(uint32_t fetchdat)
|
|||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
|
||||
x87_push((double)templ);
|
||||
CLOCK_CYCLES(9);
|
||||
CLOCK_CYCLES(x87_timings.fild_32);
|
||||
return 0;
|
||||
}
|
||||
static int opFILDil_a32(uint32_t fetchdat)
|
||||
|
|
@ -229,7 +231,7 @@ static int opFILDil_a32(uint32_t fetchdat)
|
|||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
|
||||
x87_push((double)templ);
|
||||
CLOCK_CYCLES(9);
|
||||
CLOCK_CYCLES(x87_timings.fild_32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +246,7 @@ static int opFISTil_a16(uint32_t fetchdat)
|
|||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
fatal("FISTl out of range! %i\n", temp64);*/
|
||||
seteal((int32_t)temp64);
|
||||
CLOCK_CYCLES(28);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
static int opFISTil_a32(uint32_t fetchdat)
|
||||
|
|
@ -258,7 +260,7 @@ static int opFISTil_a32(uint32_t fetchdat)
|
|||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
fatal("FISTl out of range! %i\n", temp64);*/
|
||||
seteal((int32_t)temp64);
|
||||
CLOCK_CYCLES(28);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +276,7 @@ static int opFISTPil_a16(uint32_t fetchdat)
|
|||
fatal("FISTl out of range! %i\n", temp64);*/
|
||||
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(28);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
return 0;
|
||||
}
|
||||
static int opFISTPil_a32(uint32_t fetchdat)
|
||||
|
|
@ -289,7 +291,7 @@ static int opFISTPil_a32(uint32_t fetchdat)
|
|||
fatal("FISTl out of range! %i\n", temp64);*/
|
||||
seteal((int32_t)temp64); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(28);
|
||||
CLOCK_CYCLES(x87_timings.fist_32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +305,7 @@ static int opFLDe_a16(uint32_t fetchdat)
|
|||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t);
|
||||
x87_push(t);
|
||||
CLOCK_CYCLES(6);
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
return 0;
|
||||
}
|
||||
static int opFLDe_a32(uint32_t fetchdat)
|
||||
|
|
@ -316,7 +318,7 @@ static int opFLDe_a32(uint32_t fetchdat)
|
|||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t);
|
||||
x87_push(t);
|
||||
CLOCK_CYCLES(6);
|
||||
CLOCK_CYCLES(x87_timings.fld_80);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -328,7 +330,7 @@ static int opFSTPe_a16(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(6);
|
||||
CLOCK_CYCLES(x87_timings.fst_80);
|
||||
return 0;
|
||||
}
|
||||
static int opFSTPe_a32(uint32_t fetchdat)
|
||||
|
|
@ -339,7 +341,7 @@ static int opFSTPe_a32(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(6);
|
||||
CLOCK_CYCLES(x87_timings.fst_80);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -353,7 +355,7 @@ static int opFLDd_a16(uint32_t fetchdat)
|
|||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t.d);
|
||||
x87_push(t.d);
|
||||
CLOCK_CYCLES(3);
|
||||
CLOCK_CYCLES(x87_timings.fld_64);
|
||||
return 0;
|
||||
}
|
||||
static int opFLDd_a32(uint32_t fetchdat)
|
||||
|
|
@ -366,7 +368,7 @@ static int opFLDd_a32(uint32_t fetchdat)
|
|||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t.d);
|
||||
x87_push(t.d);
|
||||
CLOCK_CYCLES(3);
|
||||
CLOCK_CYCLES(x87_timings.fld_64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -379,7 +381,7 @@ static int opFSTd_a16(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
CLOCK_CYCLES(8);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
static int opFSTd_a32(uint32_t fetchdat)
|
||||
|
|
@ -391,7 +393,7 @@ static int opFSTd_a32(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
CLOCK_CYCLES(8);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
|
||||
|
|
@ -406,7 +408,7 @@ static int opFSTPd_a16(uint32_t fetchdat)
|
|||
t.d = ST(0);
|
||||
seteaq(t.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(8);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
return 0;
|
||||
}
|
||||
static int opFSTPd_a32(uint32_t fetchdat)
|
||||
|
|
@ -420,7 +422,7 @@ static int opFSTPd_a32(uint32_t fetchdat)
|
|||
t.d = ST(0);
|
||||
seteaq(t.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(8);
|
||||
CLOCK_CYCLES(x87_timings.fst_64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -434,7 +436,7 @@ static int opFLDs_a16(uint32_t fetchdat)
|
|||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", ts.s);
|
||||
x87_push((double)ts.s);
|
||||
CLOCK_CYCLES(3);
|
||||
CLOCK_CYCLES(x87_timings.fld_32);
|
||||
return 0;
|
||||
}
|
||||
static int opFLDs_a32(uint32_t fetchdat)
|
||||
|
|
@ -447,7 +449,7 @@ static int opFLDs_a32(uint32_t fetchdat)
|
|||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", ts.s);
|
||||
x87_push((double)ts.s);
|
||||
CLOCK_CYCLES(3);
|
||||
CLOCK_CYCLES(x87_timings.fld_32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -460,7 +462,7 @@ static int opFSTs_a16(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
CLOCK_CYCLES(7);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
static int opFSTs_a32(uint32_t fetchdat)
|
||||
|
|
@ -472,7 +474,7 @@ static int opFSTs_a32(uint32_t fetchdat)
|
|||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
CLOCK_CYCLES(7);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
return cpu_state.abrt;
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +488,7 @@ static int opFSTPs_a16(uint32_t fetchdat)
|
|||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(7);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
return 0;
|
||||
}
|
||||
static int opFSTPs_a32(uint32_t fetchdat)
|
||||
|
|
@ -499,6 +501,6 @@ static int opFSTPs_a32(uint32_t fetchdat)
|
|||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
CLOCK_CYCLES(7);
|
||||
CLOCK_CYCLES(x87_timings.fst_32);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue