Some clang-formatting in src/cpu

This commit is contained in:
Jasmine Iwanek
2022-09-20 01:00:45 -04:00
parent b2fb6dbeec
commit b4673117fd
6 changed files with 5424 additions and 5271 deletions

View File

@@ -6,7 +6,7 @@
#include <wchar.h> #include <wchar.h>
#include <math.h> #include <math.h>
#ifndef INFINITY #ifndef INFINITY
# define INFINITY (__builtin_inff()) # define INFINITY (__builtin_inff())
#endif #endif
#define HAVE_STDARG_H #define HAVE_STDARG_H
@@ -25,14 +25,12 @@
#include <86box/gdbstub.h> #include <86box/gdbstub.h>
#include "386_common.h" #include "386_common.h"
#ifdef USE_NEW_DYNAREC #ifdef USE_NEW_DYNAREC
#include "codegen.h" # include "codegen.h"
#endif #endif
#undef CPU_BLOCK_END #undef CPU_BLOCK_END
#define CPU_BLOCK_END() #define CPU_BLOCK_END()
extern int codegen_flags_changed; extern int codegen_flags_changed;
int tempc, oldcpl, optype, inttype, oddeven = 0; int tempc, oldcpl, optype, inttype, oddeven = 0;
@@ -41,225 +39,229 @@ int timetolive;
uint16_t oldcs; uint16_t oldcs;
uint32_t oldds, oldss, olddslimit, oldsslimit, uint32_t oldds, oldss, olddslimit, oldsslimit,
olddslimitw, oldsslimitw; olddslimitw, oldsslimitw;
uint32_t oxpc; uint32_t oxpc;
uint32_t rmdat32; uint32_t rmdat32;
uint32_t backupregs[16]; uint32_t backupregs[16];
x86seg _oldds; x86seg _oldds;
#ifdef ENABLE_386_LOG #ifdef ENABLE_386_LOG
int x386_do_log = ENABLE_386_LOG; int x386_do_log = ENABLE_386_LOG;
void void
x386_log(const char *fmt, ...) x386_log(const char *fmt, ...)
{ {
va_list ap; va_list ap;
if (x386_do_log) { if (x386_do_log) {
va_start(ap, fmt); va_start(ap, fmt);
pclog_ex(fmt, ap); pclog_ex(fmt, ap);
va_end(ap); va_end(ap);
} }
} }
#else #else
#define x386_log(fmt, ...) # define x386_log(fmt, ...)
#endif #endif
#undef CPU_BLOCK_END #undef CPU_BLOCK_END
#define CPU_BLOCK_END() #define CPU_BLOCK_END()
#include "x86_flags.h" #include "x86_flags.h"
#define getbytef() ((uint8_t)(fetchdat)); cpu_state.pc++ #define getbytef() \
#define getwordf() ((uint16_t)(fetchdat)); cpu_state.pc+=2 ((uint8_t) (fetchdat)); \
#define getbyte2f() ((uint8_t)(fetchdat>>8)); cpu_state.pc++ cpu_state.pc++
#define getword2f() ((uint16_t)(fetchdat>>8)); cpu_state.pc+=2 #define getwordf() \
((uint16_t) (fetchdat)); \
cpu_state.pc += 2
#define getbyte2f() \
((uint8_t) (fetchdat >> 8)); \
cpu_state.pc++
#define getword2f() \
((uint16_t) (fetchdat >> 8)); \
cpu_state.pc += 2
#define OP_TABLE(name) ops_##name
#define OP_TABLE(name) ops_ ## name
#if 0 #if 0
#define CLOCK_CYCLES(c) \ # define CLOCK_CYCLES(c) \
{\ { \
if (fpu_cycles > 0) {\ if (fpu_cycles > 0) { \
fpu_cycles -= (c);\ fpu_cycles -= (c); \
if (fpu_cycles < 0) {\ if (fpu_cycles < 0) { \
cycles += fpu_cycles;\ cycles += fpu_cycles; \
}\ } \
} else {\ } else { \
cycles -= (c);\ cycles -= (c); \
}\ } \
} }
#define CLOCK_CYCLES_FPU(c) cycles -= (c) # define CLOCK_CYCLES_FPU(c) cycles -= (c)
#define CONCURRENCY_CYCLES(c) fpu_cycles = (c) # define CONCURRENCY_CYCLES(c) fpu_cycles = (c)
#else #else
#define CLOCK_CYCLES(c) cycles -= (c) # define CLOCK_CYCLES(c) cycles -= (c)
#define CLOCK_CYCLES_FPU(c) cycles -= (c) # define CLOCK_CYCLES_FPU(c) cycles -= (c)
#define CONCURRENCY_CYCLES(c) # define CONCURRENCY_CYCLES(c)
#endif #endif
#define CLOCK_CYCLES_ALWAYS(c) cycles -= (c) #define CLOCK_CYCLES_ALWAYS(c) cycles -= (c)
#include "x86_ops.h" #include "x86_ops.h"
void void
exec386(int cycs) exec386(int cycs)
{ {
int vector, tempi, cycdiff, oldcyc; int vector, tempi, cycdiff, oldcyc;
int cycle_period, ins_cycles; int cycle_period, ins_cycles;
uint32_t addr; uint32_t addr;
cycles += cycs; cycles += cycs;
while (cycles > 0) { while (cycles > 0) {
cycle_period = (timer_target - (uint32_t)tsc) + 1; cycle_period = (timer_target - (uint32_t) tsc) + 1;
x86_was_reset = 0; x86_was_reset = 0;
cycdiff = 0; cycdiff = 0;
oldcyc = cycles; oldcyc = cycles;
while (cycdiff < cycle_period) { while (cycdiff < cycle_period) {
ins_cycles = cycles; ins_cycles = cycles;
#ifndef USE_NEW_DYNAREC #ifndef USE_NEW_DYNAREC
oldcs=CS; oldcs = CS;
oldcpl=CPL; oldcpl = CPL;
#endif #endif
cpu_state.oldpc = cpu_state.pc; cpu_state.oldpc = cpu_state.pc;
cpu_state.op32 = use32; cpu_state.op32 = use32;
#ifndef USE_NEW_DYNAREC #ifndef USE_NEW_DYNAREC
x86_was_reset = 0; x86_was_reset = 0;
#endif #endif
cpu_state.ea_seg = &cpu_state.seg_ds; cpu_state.ea_seg = &cpu_state.seg_ds;
cpu_state.ssegs = 0; cpu_state.ssegs = 0;
fetchdat = fastreadl(cs + cpu_state.pc); fetchdat = fastreadl(cs + cpu_state.pc);
if (!cpu_state.abrt) { if (!cpu_state.abrt) {
#ifdef ENABLE_386_LOG #ifdef ENABLE_386_LOG
if (in_smm) if (in_smm)
x386_log("[%04X:%08X] %08X\n", CS, cpu_state.pc, fetchdat); x386_log("[%04X:%08X] %08X\n", CS, cpu_state.pc, fetchdat);
#endif #endif
opcode = fetchdat & 0xFF; opcode = fetchdat & 0xFF;
fetchdat >>= 8; fetchdat >>= 8;
trap = cpu_state.flags & T_FLAG; trap = cpu_state.flags & T_FLAG;
cpu_state.pc++; cpu_state.pc++;
x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat);
if (x86_was_reset) if (x86_was_reset)
break; break;
} }
#ifdef ENABLE_386_LOG #ifdef ENABLE_386_LOG
else if (in_smm) else if (in_smm)
x386_log("[%04X:%08X] ABRT\n", CS, cpu_state.pc); x386_log("[%04X:%08X] ABRT\n", CS, cpu_state.pc);
#endif #endif
#ifndef USE_NEW_DYNAREC #ifndef USE_NEW_DYNAREC
if (!use32) cpu_state.pc &= 0xffff; if (!use32)
cpu_state.pc &= 0xffff;
#endif #endif
if (cpu_end_block_after_ins) if (cpu_end_block_after_ins)
cpu_end_block_after_ins--; cpu_end_block_after_ins--;
if (cpu_state.abrt) { if (cpu_state.abrt) {
flags_rebuild(); flags_rebuild();
tempi = cpu_state.abrt & ABRT_MASK; tempi = cpu_state.abrt & ABRT_MASK;
cpu_state.abrt = 0; cpu_state.abrt = 0;
x86_doabrt(tempi); x86_doabrt(tempi);
if (cpu_state.abrt) { if (cpu_state.abrt) {
cpu_state.abrt = 0; cpu_state.abrt = 0;
#ifndef USE_NEW_DYNAREC #ifndef USE_NEW_DYNAREC
CS = oldcs; CS = oldcs;
#endif #endif
cpu_state.pc = cpu_state.oldpc; cpu_state.pc = cpu_state.oldpc;
x386_log("Double fault\n"); x386_log("Double fault\n");
pmodeint(8, 0); pmodeint(8, 0);
if (cpu_state.abrt) { if (cpu_state.abrt) {
cpu_state.abrt = 0; cpu_state.abrt = 0;
softresetx86(); softresetx86();
cpu_set_edx(); cpu_set_edx();
#ifdef ENABLE_386_LOG #ifdef ENABLE_386_LOG
x386_log("Triple fault - reset\n"); x386_log("Triple fault - reset\n");
#endif #endif
} }
} }
} }
if (smi_line) if (smi_line)
enter_smm_check(0); enter_smm_check(0);
else if (trap) { else if (trap) {
flags_rebuild(); flags_rebuild();
dr[6] |= 0x4000; dr[6] |= 0x4000;
if (msw&1) if (msw & 1)
pmodeint(1,0); pmodeint(1, 0);
else { else {
writememw(ss, (SP - 2) & 0xFFFF, cpu_state.flags); writememw(ss, (SP - 2) & 0xFFFF, cpu_state.flags);
writememw(ss, (SP - 4) & 0xFFFF, CS); writememw(ss, (SP - 4) & 0xFFFF, CS);
writememw(ss, (SP - 6) & 0xFFFF, cpu_state.pc); writememw(ss, (SP - 6) & 0xFFFF, cpu_state.pc);
SP -= 6; SP -= 6;
addr = (1 << 2) + idt.base; addr = (1 << 2) + idt.base;
cpu_state.flags &= ~I_FLAG; cpu_state.flags &= ~I_FLAG;
cpu_state.flags &= ~T_FLAG; cpu_state.flags &= ~T_FLAG;
cpu_state.pc = readmemw(0, addr); cpu_state.pc = readmemw(0, addr);
loadcs(readmemw(0, addr + 2)); loadcs(readmemw(0, addr + 2));
} }
} else if (nmi && nmi_enable && nmi_mask) { } else if (nmi && nmi_enable && nmi_mask) {
cpu_state.oldpc = cpu_state.pc; cpu_state.oldpc = cpu_state.pc;
x86_int(2); x86_int(2);
nmi_enable = 0; nmi_enable = 0;
#ifdef OLD_NMI_BEHAVIOR #ifdef OLD_NMI_BEHAVIOR
if (nmi_auto_clear) { if (nmi_auto_clear) {
nmi_auto_clear = 0; nmi_auto_clear = 0;
nmi = 0; nmi = 0;
} }
#else #else
nmi = 0; nmi = 0;
#endif #endif
} else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) { } else if ((cpu_state.flags & I_FLAG) && pic.int_pending && !cpu_end_block_after_ins) {
vector = picinterrupt(); vector = picinterrupt();
if (vector != -1) { if (vector != -1) {
flags_rebuild(); flags_rebuild();
if (msw & 1) if (msw & 1)
pmodeint(vector, 0); pmodeint(vector, 0);
else { else {
writememw(ss, (SP - 2) & 0xFFFF, cpu_state.flags); writememw(ss, (SP - 2) & 0xFFFF, cpu_state.flags);
writememw(ss, (SP - 4) & 0xFFFF, CS); writememw(ss, (SP - 4) & 0xFFFF, CS);
writememw(ss, (SP - 6) & 0xFFFF, cpu_state.pc); writememw(ss, (SP - 6) & 0xFFFF, cpu_state.pc);
SP -= 6; SP -= 6;
addr = (vector << 2) + idt.base; addr = (vector << 2) + idt.base;
cpu_state.flags &= ~I_FLAG; cpu_state.flags &= ~I_FLAG;
cpu_state.flags &= ~T_FLAG; cpu_state.flags &= ~T_FLAG;
cpu_state.pc = readmemw(0, addr); cpu_state.pc = readmemw(0, addr);
loadcs(readmemw(0, addr + 2)); loadcs(readmemw(0, addr + 2));
} }
} }
} }
ins_cycles -= cycles; ins_cycles -= cycles;
tsc += ins_cycles; tsc += ins_cycles;
cycdiff = oldcyc - cycles; cycdiff = oldcyc - cycles;
if (timetolive) { if (timetolive) {
timetolive--; timetolive--;
if (!timetolive) if (!timetolive)
fatal("Life expired\n"); fatal("Life expired\n");
} }
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc))
timer_process_inline(); timer_process_inline();
#ifdef USE_GDBSTUB #ifdef USE_GDBSTUB
if (gdbstub_instruction()) if (gdbstub_instruction())
return; return;
#endif #endif
} }
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -10,461 +10,455 @@
x87_timings_t x87_timings; x87_timings_t x87_timings;
x87_timings_t x87_concurrency; x87_timings_t x87_concurrency;
const x87_timings_t x87_timings_8087 = const x87_timings_t x87_timings_8087 = {
{ .f2xm1 = (310 + 630) / 2,
.f2xm1 = (310 + 630) / 2, .fabs = (10 + 17) / 2,
.fabs = (10 + 17) / 2, .fadd = (70 + 100) / 2,
.fadd = (70 + 100) / 2, .fadd_32 = (90 + 120) / 2,
.fadd_32 = (90 + 120) / 2, .fadd_64 = (95 + 125) / 2,
.fadd_64 = (95 + 125) / 2, .fbld = (290 + 310) / 2,
.fbld = (290 + 310) / 2, .fbstp = (520 + 540) / 2,
.fbstp = (520 + 540) / 2, .fchs = (10 + 17) / 2,
.fchs = (10 + 17) / 2, .fclex = (2 + 8) / 2,
.fclex = (2 + 8) / 2, .fcom = (40 + 50) / 2,
.fcom = (40 + 50) / 2, .fcom_32 = (60 + 70) / 2,
.fcom_32 = (60 + 70) / 2, .fcom_64 = (65 + 75) / 2,
.fcom_64 = (65 + 75) / 2, .fcos = 0, /*387+*/
.fcos = 0, /*387+*/ .fincdecstp = (6 + 12) / 2,
.fincdecstp = (6 + 12) / 2, .fdisi_eni = (6 + 12) / 2,
.fdisi_eni = (6 + 12) / 2, .fdiv = (193 + 203) / 2,
.fdiv = (193 + 203) / 2, .fdiv_32 = (215 + 225) / 2,
.fdiv_32 = (215 + 225) / 2, .fdiv_64 = (220 + 230) / 2,
.fdiv_64 = (220 + 230) / 2, .ffree = (9 + 16) / 2,
.ffree = (9 + 16) / 2, .fadd_i16 = (102 + 137) / 2,
.fadd_i16 = (102 + 137) / 2, .fadd_i32 = (108 + 143) / 2,
.fadd_i32 = (108 + 143) / 2, .fcom_i16 = (72 + 86) / 2,
.fcom_i16 = (72 + 86) / 2, .fcom_i32 = (78 + 91) / 2,
.fcom_i32 = (78 + 91) / 2, .fdiv_i16 = (224 + 238) / 2,
.fdiv_i16 = (224 + 238) / 2, .fdiv_i32 = (230 + 243) / 2,
.fdiv_i32 = (230 + 243) / 2, .fild_16 = (46 + 54) / 2,
.fild_16 = (46 + 54) / 2, .fild_32 = (50 + 60) / 2,
.fild_32 = (50 + 60) / 2, .fild_64 = (60 + 68) / 2,
.fild_64 = (60 + 68) / 2, .fmul_i16 = (124 + 138) / 2,
.fmul_i16 = (124 + 138) / 2, .fmul_i32 = (130 + 144) / 2,
.fmul_i32 = (130 + 144) / 2, .finit = (2 + 8) / 2,
.finit = (2 + 8) / 2, .fist_16 = (80 + 90) / 2,
.fist_16 = (80 + 90) / 2, .fist_32 = (82 + 92) / 2,
.fist_32 = (82 + 92) / 2, .fist_64 = (94 + 105) / 2,
.fist_64 = (94 + 105) / 2, .fld = (17 + 22) / 2,
.fld = (17 + 22) / 2, .fld_32 = (38 + 56) / 2,
.fld_32 = (38 + 56) / 2, .fld_64 = (40 + 60) / 2,
.fld_64 = (40 + 60) / 2, .fld_80 = (53 + 65) / 2,
.fld_80 = (53 + 65) / 2, .fld_z1 = (11 + 21) / 2,
.fld_z1 = (11 + 21) / 2, .fld_const = (15 + 24) / 2,
.fld_const = (15 + 24) / 2, .fldcw = (7 + 14) / 2,
.fldcw = (7 + 14) / 2, .fldenv = (35 + 45) / 2,
.fldenv = (35 + 45) / 2, .fmul = (90 + 145) / 2,
.fmul = (90 + 145) / 2, .fmul_32 = (110 + 125) / 2,
.fmul_32 = (110 + 125) / 2, .fmul_64 = (154 + 168) / 2,
.fmul_64 = (154 + 168) / 2, .fnop = (10 + 16) / 2,
.fnop = (10 + 16) / 2, .fpatan = (250 + 800) / 2,
.fpatan = (250 + 800) / 2, .fprem = (15 + 190) / 2,
.fprem = (15 + 190) / 2, .fprem1 = 0, /*387+*/
.fprem1 = 0, /*387+*/ .fptan = (30 + 540) / 2,
.fptan = (30 + 540) / 2, .frndint = (16 + 50) / 2,
.frndint = (16 + 50) / 2, .frstor = (197 + 207) / 2,
.frstor = (197 + 207) / 2, .fsave = (197 + 207) / 2,
.fsave = (197 + 207) / 2, .fscale = (32 + 38) / 2,
.fscale = (32 + 38) / 2, .fsetpm = 0, /*287+*/
.fsetpm = 0, /*287+*/ .fsin_cos = 0, /*387+*/
.fsin_cos = 0, /*387+*/ .fsincos = 0, /*387+*/
.fsincos = 0, /*387+*/ .fsqrt = (180 + 186) / 2,
.fsqrt = (180 + 186) / 2, .fst = (15 + 22) / 2,
.fst = (15 + 22) / 2, .fst_32 = (84 + 90) / 2,
.fst_32 = (84 + 90) / 2, .fst_64 = (96 + 104) / 2,
.fst_64 = (96 + 104) / 2, .fst_80 = (52 + 58) / 2,
.fst_80 = (52 + 58) / 2, .fstcw_sw = (12 + 18) / 2,
.fstcw_sw = (12 + 18) / 2, .fstenv = (40 + 50) / 2,
.fstenv = (40 + 50) / 2, .ftst = (38 + 48) / 2,
.ftst = (38 + 48) / 2, .fucom = 0, /*387+*/
.fucom = 0, /*387+*/ .fwait = 4,
.fwait = 4, .fxam = (12 + 23) / 2,
.fxam = (12 + 23) / 2, .fxch = (10 + 15) / 2,
.fxch = (10 + 15) / 2, .fxtract = (27 + 55) / 2,
.fxtract = (27 + 55) / 2, .fyl2x = (900 + 1100) / 2,
.fyl2x = (900 + 1100) / 2, .fyl2xp1 = (700 + 1000) / 2
.fyl2xp1 = (700 + 1000) / 2
}; };
/*Mostly the same as 8087*/ /*Mostly the same as 8087*/
const x87_timings_t x87_timings_287 = const x87_timings_t x87_timings_287 = {
{ .f2xm1 = (310 + 630) / 2,
.f2xm1 = (310 + 630) / 2, .fabs = (10 + 17) / 2,
.fabs = (10 + 17) / 2, .fadd = (70 + 100) / 2,
.fadd = (70 + 100) / 2, .fadd_32 = (90 + 120) / 2,
.fadd_32 = (90 + 120) / 2, .fadd_64 = (95 + 125) / 2,
.fadd_64 = (95 + 125) / 2, .fbld = (290 + 310) / 2,
.fbld = (290 + 310) / 2, .fbstp = (520 + 540) / 2,
.fbstp = (520 + 540) / 2, .fchs = (10 + 17) / 2,
.fchs = (10 + 17) / 2, .fclex = (2 + 8) / 2,
.fclex = (2 + 8) / 2, .fcom = (40 + 50) / 2,
.fcom = (40 + 50) / 2, .fcom_32 = (60 + 70) / 2,
.fcom_32 = (60 + 70) / 2, .fcom_64 = (65 + 75) / 2,
.fcom_64 = (65 + 75) / 2, .fcos = 0, /*387+*/
.fcos = 0, /*387+*/ .fincdecstp = (6 + 12) / 2,
.fincdecstp = (6 + 12) / 2, .fdisi_eni = 2,
.fdisi_eni = 2, .fdiv = (193 + 203) / 2,
.fdiv = (193 + 203) / 2, .fdiv_32 = (215 + 225) / 2,
.fdiv_32 = (215 + 225) / 2, .fdiv_64 = (220 + 230) / 2,
.fdiv_64 = (220 + 230) / 2, .ffree = (9 + 16) / 2,
.ffree = (9 + 16) / 2, .fadd_i16 = (102 + 137) / 2,
.fadd_i16 = (102 + 137) / 2, .fadd_i32 = (108 + 143) / 2,
.fadd_i32 = (108 + 143) / 2, .fcom_i16 = (72 + 86) / 2,
.fcom_i16 = (72 + 86) / 2, .fcom_i32 = (78 + 91) / 2,
.fcom_i32 = (78 + 91) / 2, .fdiv_i16 = (224 + 238) / 2,
.fdiv_i16 = (224 + 238) / 2, .fdiv_i32 = (230 + 243) / 2,
.fdiv_i32 = (230 + 243) / 2, .fild_16 = (46 + 54) / 2,
.fild_16 = (46 + 54) / 2, .fild_32 = (50 + 60) / 2,
.fild_32 = (50 + 60) / 2, .fild_64 = (60 + 68) / 2,
.fild_64 = (60 + 68) / 2, .fmul_i16 = (124 + 138) / 2,
.fmul_i16 = (124 + 138) / 2, .fmul_i32 = (130 + 144) / 2,
.fmul_i32 = (130 + 144) / 2, .finit = (2 + 8) / 2,
.finit = (2 + 8) / 2, .fist_16 = (80 + 90) / 2,
.fist_16 = (80 + 90) / 2, .fist_32 = (82 + 92) / 2,
.fist_32 = (82 + 92) / 2, .fist_64 = (94 + 105) / 2,
.fist_64 = (94 + 105) / 2, .fld = (17 + 22) / 2,
.fld = (17 + 22) / 2, .fld_32 = (38 + 56) / 2,
.fld_32 = (38 + 56) / 2, .fld_64 = (40 + 60) / 2,
.fld_64 = (40 + 60) / 2, .fld_80 = (53 + 65) / 2,
.fld_80 = (53 + 65) / 2, .fld_z1 = (11 + 21) / 2,
.fld_z1 = (11 + 21) / 2, .fld_const = (15 + 24) / 2,
.fld_const = (15 + 24) / 2, .fldcw = (7 + 14) / 2,
.fldcw = (7 + 14) / 2, .fldenv = (35 + 45) / 2,
.fldenv = (35 + 45) / 2, .fmul = (90 + 145) / 2,
.fmul = (90 + 145) / 2, .fmul_32 = (110 + 125) / 2,
.fmul_32 = (110 + 125) / 2, .fmul_64 = (154 + 168) / 2,
.fmul_64 = (154 + 168) / 2, .fnop = (10 + 16) / 2,
.fnop = (10 + 16) / 2, .fpatan = (250 + 800) / 2,
.fpatan = (250 + 800) / 2, .fprem = (15 + 190) / 2,
.fprem = (15 + 190) / 2, .fprem1 = 0, /*387+*/
.fprem1 = 0, /*387+*/ .fptan = (30 + 540) / 2,
.fptan = (30 + 540) / 2, .frndint = (16 + 50) / 2,
.frndint = (16 + 50) / 2, .frstor = (197 + 207) / 2,
.frstor = (197 + 207) / 2, .fsave = (197 + 207) / 2,
.fsave = (197 + 207) / 2, .fscale = (32 + 38) / 2,
.fscale = (32 + 38) / 2, .fsetpm = (2 + 8) / 2, /*287+*/
.fsetpm = (2 + 8) / 2, /*287+*/ .fsin_cos = 0, /*387+*/
.fsin_cos = 0, /*387+*/ .fsincos = 0, /*387+*/
.fsincos = 0, /*387+*/ .fsqrt = (180 + 186) / 2,
.fsqrt = (180 + 186) / 2, .fst = (15 + 22) / 2,
.fst = (15 + 22) / 2, .fst_32 = (84 + 90) / 2,
.fst_32 = (84 + 90) / 2, .fst_64 = (96 + 104) / 2,
.fst_64 = (96 + 104) / 2, .fst_80 = (52 + 58) / 2,
.fst_80 = (52 + 58) / 2, .fstcw_sw = (12 + 18) / 2,
.fstcw_sw = (12 + 18) / 2, .fstenv = (40 + 50) / 2,
.fstenv = (40 + 50) / 2, .ftst = (38 + 48) / 2,
.ftst = (38 + 48) / 2, .fucom = 0, /*387+*/
.fucom = 0, /*387+*/ .fwait = 3,
.fwait = 3, .fxam = (12 + 23) / 2,
.fxam = (12 + 23) / 2, .fxch = (10 + 15) / 2,
.fxch = (10 + 15) / 2, .fxtract = (27 + 55) / 2,
.fxtract = (27 + 55) / 2, .fyl2x = (900 + 1100) / 2,
.fyl2x = (900 + 1100) / 2, .fyl2xp1 = (700 + 1000) / 2
.fyl2xp1 = (700 + 1000) / 2
}; };
const x87_timings_t x87_timings_387 = const x87_timings_t x87_timings_387 = {
{ .f2xm1 = (211 + 476) / 2,
.f2xm1 = (211 + 476) / 2, .fabs = 22,
.fabs = 22, .fadd = (23 + 34) / 2,
.fadd = (23 + 34) / 2, .fadd_32 = (24 + 32) / 2,
.fadd_32 = (24 + 32) / 2, .fadd_64 = (29 + 37) / 2,
.fadd_64 = (29 + 37) / 2, .fbld = (266 + 275) / 2,
.fbld = (266 + 275) / 2, .fbstp = (512 + 534) / 2,
.fbstp = (512 + 534) / 2, .fchs = (24 + 25) / 2,
.fchs = (24 + 25) / 2, .fclex = 11,
.fclex = 11, .fcom = 24,
.fcom = 24, .fcom_32 = 26,
.fcom_32 = 26, .fcom_64 = 31,
.fcom_64 = 31, .fcos = (122 + 772) / 2,
.fcos = (122 + 772) / 2, .fincdecstp = 22,
.fincdecstp = 22, .fdisi_eni = 2,
.fdisi_eni = 2, .fdiv = (88 + 91) / 2,
.fdiv = (88 + 91) / 2, .fdiv_32 = 89,
.fdiv_32 = 89, .fdiv_64 = 94,
.fdiv_64 = 94, .ffree = 18,
.ffree = 18, .fadd_i16 = (71 + 85) / 2,
.fadd_i16 = (71 + 85) / 2, .fadd_i32 = (57 + 72) / 2,
.fadd_i32 = (57 + 72) / 2, .fcom_i16 = (71 + 75) / 2,
.fcom_i16 = (71 + 75) / 2, .fcom_i32 = (56 + 63) / 2,
.fcom_i32 = (56 + 63) / 2, .fdiv_i16 = (136 + 140) / 2,
.fdiv_i16 = (136 + 140) / 2, .fdiv_i32 = (120 + 127) / 2,
.fdiv_i32 = (120 + 127) / 2, .fild_16 = (61 + 65) / 2,
.fild_16 = (61 + 65) / 2, .fild_32 = (45 + 52) / 2,
.fild_32 = (45 + 52) / 2, .fild_64 = (56 + 67) / 2,
.fild_64 = (56 + 67) / 2, .fmul_i16 = (76 + 87) / 2,
.fmul_i16 = (76 + 87) / 2, .fmul_i32 = (61 + 82) / 2,
.fmul_i32 = (61 + 82) / 2, .finit = 33,
.finit = 33, .fist_16 = (82 + 95) / 2,
.fist_16 = (82 + 95) / 2, .fist_32 = (79 + 93) / 2,
.fist_32 = (79 + 93) / 2, .fist_64 = (80 + 97) / 2,
.fist_64 = (80 + 97) / 2, .fld = 14,
.fld = 14, .fld_32 = 20,
.fld_32 = 20, .fld_64 = 25,
.fld_64 = 25, .fld_80 = 44,
.fld_80 = 44, .fld_z1 = (20 + 24) / 2,
.fld_z1 = (20 + 24) / 2, .fld_const = 40,
.fld_const = 40, .fldcw = 19,
.fldcw = 19, .fldenv = 71,
.fldenv = 71, .fmul = (29 + 57) / 2,
.fmul = (29 + 57) / 2, .fmul_32 = (27 + 35) / 2,
.fmul_32 = (27 + 35) / 2, .fmul_64 = (32 + 57) / 2,
.fmul_64 = (32 + 57) / 2, .fnop = 12,
.fnop = 12, .fpatan = (314 + 487) / 2,
.fpatan = (314 + 487) / 2, .fprem = (74 + 155) / 2,
.fprem = (74 + 155) / 2, .fprem1 = (95 + 185) / 2,
.fprem1 = (95 + 185) / 2, .fptan = (191 + 497) / 2,
.fptan = (191 + 497) / 2, .frndint = (66 + 80) / 2,
.frndint = (66 + 80) / 2, .frstor = 308,
.frstor = 308, .fsave = 375,
.fsave = 375, .fscale = (67 + 86) / 2,
.fscale = (67 + 86) / 2, .fsetpm = 12,
.fsetpm = 12, .fsin_cos = (122 + 771) / 2,
.fsin_cos = (122 + 771) / 2, .fsincos = (194 + 809) / 2,
.fsincos = (194 + 809) / 2, .fsqrt = (122 + 129) / 2,
.fsqrt = (122 + 129) / 2, .fst = 11,
.fst = 11, .fst_32 = 44,
.fst_32 = 44, .fst_64 = 45,
.fst_64 = 45, .fst_80 = 53,
.fst_80 = 53, .fstcw_sw = 15,
.fstcw_sw = 15, .fstenv = 103,
.fstenv = 103, .ftst = 28,
.ftst = 28, .fucom = 24,
.fucom = 24, .fwait = 6,
.fwait = 6, .fxam = (30 + 38) / 2,
.fxam = (30 + 38) / 2, .fxch = 18,
.fxch = 18, .fxtract = (70 + 76) / 2,
.fxtract = (70 + 76) / 2, .fyl2x = (120 + 538) / 2,
.fyl2x = (120 + 538) / 2, .fyl2xp1 = (257 + 547) / 2
.fyl2xp1 = (257 + 547) / 2
}; };
const x87_timings_t x87_timings_486 = const x87_timings_t x87_timings_486 = {
{ .f2xm1 = (140 + 270) / 2,
.f2xm1 = (140 + 270) / 2, .fabs = 3,
.fabs = 3, .fadd = (8 + 20) / 2,
.fadd = (8 + 20) / 2, .fadd_32 = (8 + 20) / 2,
.fadd_32 = (8 + 20) / 2, .fadd_64 = (8 + 20) / 2,
.fadd_64 = (8 + 20) / 2, .fbld = (70 + 103) / 2,
.fbld = (70 + 103) / 2, .fbstp = (172 + 176) / 2,
.fbstp = (172 + 176) / 2, .fchs = 6,
.fchs = 6, .fclex = 7,
.fclex = 7, .fcom = 4,
.fcom = 4, .fcom_32 = 4,
.fcom_32 = 4, .fcom_64 = 4,
.fcom_64 = 4, .fcos = (257 + 354) / 2,
.fcos = (257 + 354) / 2, .fincdecstp = 3,
.fincdecstp = 3, .fdisi_eni = 3,
.fdisi_eni = 3, .fdiv = 73,
.fdiv = 73, .fdiv_32 = 73,
.fdiv_32 = 73, .fdiv_64 = 73,
.fdiv_64 = 73, .ffree = 3,
.ffree = 3, .fadd_i16 = (20 + 35) / 2,
.fadd_i16 = (20 + 35) / 2, .fadd_i32 = (19 + 32) / 2,
.fadd_i32 = (19 + 32) / 2, .fcom_i16 = (16 + 20) / 2,
.fcom_i16 = (16 + 20) / 2, .fcom_i32 = (15 + 17) / 2,
.fcom_i32 = (15 + 17) / 2, .fdiv_i16 = (85 + 89) / 2,
.fdiv_i16 = (85 + 89) / 2, .fdiv_i32 = (84 + 86) / 2,
.fdiv_i32 = (84 + 86) / 2, .fild_16 = (13 + 16) / 2,
.fild_16 = (13 + 16) / 2, .fild_32 = (9 + 12) / 2,
.fild_32 = (9 + 12) / 2, .fild_64 = (10 + 18) / 2,
.fild_64 = (10 + 18) / 2, .fmul_i16 = (23 + 27) / 2,
.fmul_i16 = (23 + 27) / 2, .fmul_i32 = (22 + 24) / 2,
.fmul_i32 = (22 + 24) / 2, .finit = 17,
.finit = 17, .fist_16 = (29 + 34) / 2,
.fist_16 = (29 + 34) / 2, .fist_32 = (28 + 34) / 2,
.fist_32 = (28 + 34) / 2, .fist_64 = (29 + 34) / 2,
.fist_64 = (29 + 34) / 2, .fld = 4,
.fld = 4, .fld_32 = 3,
.fld_32 = 3, .fld_64 = 3,
.fld_64 = 3, .fld_80 = 6,
.fld_80 = 6, .fld_z1 = 4,
.fld_z1 = 4, .fld_const = 8,
.fld_const = 8, .fldcw = 4,
.fldcw = 4, .fldenv = 34,
.fldenv = 34, .fmul = 16,
.fmul = 16, .fmul_32 = 11,
.fmul_32 = 11, .fmul_64 = 14,
.fmul_64 = 14, .fnop = 3,
.fnop = 3, .fpatan = (218 + 303) / 2,
.fpatan = (218 + 303) / 2, .fprem = (70 + 138) / 2,
.fprem = (70 + 138) / 2, .fprem1 = (72 + 167) / 2,
.fprem1 = (72 + 167) / 2, .fptan = (200 + 273) / 2,
.fptan = (200 + 273) / 2, .frndint = (21 + 30) / 2,
.frndint = (21 + 30) / 2, .frstor = 120,
.frstor = 120, .fsave = 143,
.fsave = 143, .fscale = (30 + 32) / 2,
.fscale = (30 + 32) / 2, .fsetpm = 3,
.fsetpm = 3, .fsin_cos = (257 + 354) / 2,
.fsin_cos = (257 + 354) / 2, .fsincos = (292 + 365) / 2,
.fsincos = (292 + 365) / 2, .fsqrt = (83 + 87) / 2,
.fsqrt = (83 + 87) / 2, .fst = 3,
.fst = 3, .fst_32 = 7,
.fst_32 = 7, .fst_64 = 8,
.fst_64 = 8, .fst_80 = 6,
.fst_80 = 6, .fstcw_sw = 3,
.fstcw_sw = 3, .fstenv = 56,
.fstenv = 56, .ftst = 4,
.ftst = 4, .fucom = 4,
.fucom = 4, .fwait = (1 + 3) / 2,
.fwait = (1 + 3) / 2, .fxam = 8,
.fxam = 8, .fxch = 4,
.fxch = 4, .fxtract = (16 + 20) / 2,
.fxtract = (16 + 20) / 2, .fyl2x = (196 + 329) / 2,
.fyl2x = (196 + 329) / 2, .fyl2xp1 = (171 + 326) / 2
.fyl2xp1 = (171 + 326) / 2
}; };
/* this should be used for FPUs with no concurrency. /* this should be used for FPUs with no concurrency.
some pre-486DX Cyrix FPUs reportedly are like this. */ some pre-486DX Cyrix FPUs reportedly are like this. */
const x87_timings_t x87_concurrency_none = const x87_timings_t x87_concurrency_none = {
{ .f2xm1 = 0,
.f2xm1 = 0, .fabs = 0,
.fabs = 0, .fadd = 0,
.fadd = 0, .fadd_32 = 0,
.fadd_32 = 0, .fadd_64 = 0,
.fadd_64 = 0, .fbld = 0,
.fbld = 0, .fbstp = 0,
.fbstp = 0, .fchs = 0,
.fchs = 0, .fclex = 0,
.fclex = 0, .fcom = 0,
.fcom = 0, .fcom_32 = 0,
.fcom_32 = 0, .fcom_64 = 0,
.fcom_64 = 0, .fcos = 0,
.fcos = 0, .fincdecstp = 0,
.fincdecstp = 0, .fdisi_eni = 0,
.fdisi_eni = 0, .fdiv = 0,
.fdiv = 0, .fdiv_32 = 0,
.fdiv_32 = 0, .fdiv_64 = 0,
.fdiv_64 = 0, .ffree = 0,
.ffree = 0, .fadd_i16 = 0,
.fadd_i16 = 0, .fadd_i32 = 0,
.fadd_i32 = 0, .fcom_i16 = 0,
.fcom_i16 = 0, .fcom_i32 = 0,
.fcom_i32 = 0, .fdiv_i16 = 0,
.fdiv_i16 = 0, .fdiv_i32 = 0,
.fdiv_i32 = 0, .fild_16 = 0,
.fild_16 = 0, .fild_32 = 0,
.fild_32 = 0, .fild_64 = 0,
.fild_64 = 0, .fmul_i16 = 0,
.fmul_i16 = 0, .fmul_i32 = 0,
.fmul_i32 = 0, .finit = 0,
.finit = 0, .fist_16 = 0,
.fist_16 = 0, .fist_32 = 0,
.fist_32 = 0, .fist_64 = 0,
.fist_64 = 0, .fld = 0,
.fld = 0, .fld_32 = 0,
.fld_32 = 0, .fld_64 = 0,
.fld_64 = 0, .fld_80 = 0,
.fld_80 = 0, .fld_z1 = 0,
.fld_z1 = 0, .fld_const = 0,
.fld_const = 0, .fldcw = 0,
.fldcw = 0, .fldenv = 0,
.fldenv = 0, .fmul = 0,
.fmul = 0, .fmul_32 = 0,
.fmul_32 = 0, .fmul_64 = 0,
.fmul_64 = 0, .fnop = 0,
.fnop = 0, .fpatan = 0,
.fpatan = 0, .fprem = 0,
.fprem = 0, .fprem1 = 0,
.fprem1 = 0, .fptan = 0,
.fptan = 0, .frndint = 0,
.frndint = 0, .frstor = 0,
.frstor = 0, .fsave = 0,
.fsave = 0, .fscale = 0,
.fscale = 0, .fsetpm = 0,
.fsetpm = 0, .fsin_cos = 0,
.fsin_cos = 0, .fsincos = 0,
.fsincos = 0, .fsqrt = 0,
.fsqrt = 0, .fst = 0,
.fst = 0, .fst_32 = 0,
.fst_32 = 0, .fst_64 = 0,
.fst_64 = 0, .fst_80 = 0,
.fst_80 = 0, .fstcw_sw = 0,
.fstcw_sw = 0, .fstenv = 0,
.fstenv = 0, .ftst = 0,
.ftst = 0, .fucom = 0,
.fucom = 0, .fwait = 0,
.fwait = 0, .fxam = 0,
.fxam = 0, .fxch = 0,
.fxch = 0, .fxtract = 0,
.fxtract = 0, .fyl2x = 0,
.fyl2x = 0, .fyl2xp1 = 0,
.fyl2xp1 = 0,
}; };
const x87_timings_t x87_concurrency_486 = const x87_timings_t x87_concurrency_486 = {
{ .f2xm1 = 2,
.f2xm1 = 2, .fabs = 0,
.fabs = 0, .fadd = 7,
.fadd = 7, .fadd_32 = 7,
.fadd_32 = 7, .fadd_64 = 7,
.fadd_64 = 7, .fbld = 8,
.fbld = 8, .fbstp = 0,
.fbstp = 0, .fchs = 0,
.fchs = 0, .fclex = 0,
.fclex = 0, .fcom = 1,
.fcom = 1, .fcom_32 = 1,
.fcom_32 = 1, .fcom_64 = 1,
.fcom_64 = 1, .fcos = 2,
.fcos = 2, .fincdecstp = 0,
.fincdecstp = 0, .fdisi_eni = 0,
.fdisi_eni = 0, .fdiv = 70,
.fdiv = 70, .fdiv_32 = 70,
.fdiv_32 = 70, .fdiv_64 = 70,
.fdiv_64 = 70, .ffree = 0,
.ffree = 0, .fadd_i16 = 7,
.fadd_i16 = 7, .fadd_i32 = 7,
.fadd_i32 = 7, .fcom_i16 = 1,
.fcom_i16 = 1, .fcom_i32 = 1,
.fcom_i32 = 1, .fdiv_i16 = 70,
.fdiv_i16 = 70, .fdiv_i32 = 70,
.fdiv_i32 = 70, .fild_16 = 4,
.fild_16 = 4, .fild_32 = 4,
.fild_32 = 4, .fild_64 = 8,
.fild_64 = 8, .fmul_i16 = 8,
.fmul_i16 = 8, .fmul_i32 = 8,
.fmul_i32 = 8, .finit = 0,
.finit = 0, .fist_16 = 0,
.fist_16 = 0, .fist_32 = 0,
.fist_32 = 0, .fist_64 = 0,
.fist_64 = 0, .fld = 0,
.fld = 0, .fld_32 = 0,
.fld_32 = 0, .fld_64 = 0,
.fld_64 = 0, .fld_80 = 0,
.fld_80 = 0, .fld_z1 = 0,
.fld_z1 = 0, .fld_const = 2,
.fld_const = 2, .fldcw = 0,
.fldcw = 0, .fldenv = 0,
.fldenv = 0, .fmul = 13,
.fmul = 13, .fmul_32 = 8,
.fmul_32 = 8, .fmul_64 = 11,
.fmul_64 = 11, .fnop = 0,
.fnop = 0, .fpatan = 5,
.fpatan = 5, .fprem = 2,
.fprem = 2, .fprem1 = 6,
.fprem1 = 6, .fptan = 70,
.fptan = 70, .frndint = 0,
.frndint = 0, .frstor = 0,
.frstor = 0, .fsave = 0,
.fsave = 0, .fscale = 2,
.fscale = 2, .fsetpm = 0,
.fsetpm = 0, .fsin_cos = 2,
.fsin_cos = 2, .fsincos = 2,
.fsincos = 2, .fsqrt = 70,
.fsqrt = 70, .fst = 0,
.fst = 0, .fst_32 = 0,
.fst_32 = 0, .fst_64 = 0,
.fst_64 = 0, .fst_80 = 0,
.fst_80 = 0, .fstcw_sw = 0,
.fstcw_sw = 0, .fstenv = 0,
.fstenv = 0, .ftst = 1,
.ftst = 1, .fucom = 1,
.fucom = 1, .fwait = 0,
.fwait = 0, .fxam = 0,
.fxam = 0, .fxch = 0,
.fxch = 0, .fxtract = 4,
.fxtract = 4, .fyl2x = 13,
.fyl2x = 13, .fyl2xp1 = 13,
.fyl2xp1 = 13,
}; };

View File

@@ -1,51 +1,51 @@
typedef struct typedef struct
{ {
int f2xm1; int f2xm1;
int fabs; int fabs;
int fadd, fadd_32, fadd_64; int fadd, fadd_32, fadd_64;
int fbld; int fbld;
int fbstp; int fbstp;
int fchs; int fchs;
int fclex; int fclex;
int fcom, fcom_32, fcom_64; int fcom, fcom_32, fcom_64;
int fcos; int fcos;
int fincdecstp; int fincdecstp;
int fdisi_eni; int fdisi_eni;
int fdiv, fdiv_32, fdiv_64; int fdiv, fdiv_32, fdiv_64;
int ffree; int ffree;
int fadd_i16, fadd_i32; int fadd_i16, fadd_i32;
int fcom_i16, fcom_i32; int fcom_i16, fcom_i32;
int fdiv_i16, fdiv_i32; int fdiv_i16, fdiv_i32;
int fild_16, fild_32, fild_64; int fild_16, fild_32, fild_64;
int fmul_i16, fmul_i32; int fmul_i16, fmul_i32;
int finit; int finit;
int fist_16, fist_32, fist_64; int fist_16, fist_32, fist_64;
int fld, fld_32, fld_64, fld_80; int fld, fld_32, fld_64, fld_80;
int fld_z1, fld_const; int fld_z1, fld_const;
int fldcw; int fldcw;
int fldenv; int fldenv;
int fmul, fmul_32, fmul_64; int fmul, fmul_32, fmul_64;
int fnop; int fnop;
int fpatan; int fpatan;
int fprem, fprem1; int fprem, fprem1;
int fptan; int fptan;
int frndint; int frndint;
int frstor; int frstor;
int fsave; int fsave;
int fscale; int fscale;
int fsetpm; int fsetpm;
int fsin_cos, fsincos; int fsin_cos, fsincos;
int fsqrt; int fsqrt;
int fst, fst_32, fst_64, fst_80; int fst, fst_32, fst_64, fst_80;
int fstcw_sw; int fstcw_sw;
int fstenv; int fstenv;
int ftst; int ftst;
int fucom; int fucom;
int fwait; int fwait;
int fxam; int fxam;
int fxch; int fxch;
int fxtract; int fxtract;
int fyl2x, fyl2xp1; int fyl2x, fyl2xp1;
} x87_timings_t; } x87_timings_t;
extern const x87_timings_t x87_timings_8087; extern const x87_timings_t x87_timings_8087;