rec/all: optional mips counter on recs

Also de-unroll rec-cpp for debug builds
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-07-25 08:16:53 +02:00
parent 00dbd6222f
commit 51a6ed2146
3 changed files with 36 additions and 14 deletions

View File

@ -86,6 +86,8 @@ extern double speed_load_mspdf;
double speed_load_mspdf;
#endif
int mips_counter;
double full_rps;
u32 fskip=0;
@ -184,12 +186,13 @@ int spg_line_sched(int tag, int cycl, int jit)
spd_cpu*100/200,spd_vbs,
mode,res,fullvbs,
spd_fps,fskip/ts);
#else
sprintf(fpsStr,"%s/%c - %4.2f (%4.2f) - %4.2f - V: %4.2f (%.2f, %s%s%4.2f) R: %4.2f+%4.2f VTX: %4.2f%c",
#else
sprintf(fpsStr,"%s/%c - %4.2f (%4.2f) - %4.2f - V: %4.2f (%.2f, %s%s%4.2f) R: %4.2f+%4.2f VTX: %4.2f%c, MIPS: %.2f",
VER_SHORTNAME,'n',mspdf,speed_load_mspdf,spd_cpu*100/200,spd_vbs,
spd_vbs/full_rps,mode,res,fullvbs,
spd_fps,fskip/ts
,mv,mv_c);
, mv, mv_c, mips_counter/ 1024.0 / 1024.0);
mips_counter = 0;
#endif
fskip=0;

View File

@ -19,6 +19,9 @@
#define SHIL_MODE 2
#include "hw/sh4/dyna/shil_canonical.h"
#define MIPS_COUNTER 0
struct DynaRBI : RuntimeBlockInfo
{
virtual u32 Relink() {
@ -34,6 +37,7 @@ struct DynaRBI : RuntimeBlockInfo
int cycle_counter;
extern int mips_counter;
void ngen_FailedToFindBlock_internal() {
rdv_FailedToFindBlock(Sh4cntx.pc);
@ -677,16 +681,20 @@ struct opcode_writem_offs_imm : public opcodeExec {
}
};
#define DREP_1(x, phrase) if (x < cnt) ops[x]->execute();
#define DREP_2(x, phrase) DREP_1(x, phrase) DREP_1(x+1, phrase)
#define DREP_4(x, phrase) DREP_2(x, phrase) DREP_2(x+2, phrase)
#define DREP_8(x, phrase) DREP_4(x, phrase) DREP_4(x+4, phrase)
#define DREP_16(x, phrase) DREP_8(x, phrase) DREP_8(x+8, phrase)
#define DREP_32(x, phrase) DREP_16(x, phrase) DREP_16(x+16, phrase)
#define DREP_64(x, phrase) DREP_32(x, phrase) DREP_32(x+32, phrase)
#define DREP_128(x, phrase) DREP_64(x, phrase) DREP_64(x+64, phrase)
#define DREP_256(x, phrase) DREP_128(x, phrase) DREP_128(x+128, phrase)
#define DREP_512(x, phrase) DREP_256(x, phrase) DREP_256(x+256, phrase)
#if !defined(_DEBUG)
#define DREP_1(x, phrase) if (x < cnt) ops[x]->execute();
#define DREP_2(x, phrase) DREP_1(x, phrase) DREP_1(x+1, phrase)
#define DREP_4(x, phrase) DREP_2(x, phrase) DREP_2(x+2, phrase)
#define DREP_8(x, phrase) DREP_4(x, phrase) DREP_4(x+4, phrase)
#define DREP_16(x, phrase) DREP_8(x, phrase) DREP_8(x+8, phrase)
#define DREP_32(x, phrase) DREP_16(x, phrase) DREP_16(x+16, phrase)
#define DREP_64(x, phrase) DREP_32(x, phrase) DREP_32(x+32, phrase)
#define DREP_128(x, phrase) DREP_64(x, phrase) DREP_64(x+64, phrase)
#define DREP_256(x, phrase) DREP_128(x, phrase) DREP_128(x+128, phrase)
#define DREP_512(x, phrase) DREP_256(x, phrase) DREP_256(x+256, phrase)
#else
#define DREP_512(x, phrase) for (int i=0; i<cnt; i++) ops[i]->execute();
#endif
template <int cnt>
class fnblock {
@ -696,6 +704,10 @@ public:
void execute() {
cycle_counter -= cc;
#if MIPS_COUNTER
mips_counter += cnt;
#endif
DREP_512(0, phrase);
}

View File

@ -265,6 +265,7 @@ u32* GetRegPtr(u32 reg)
u32 cvld;
u32 rdmt[6];
extern u32 memops_t,memops_l;
extern int mips_counter;
void CheckBlock(RuntimeBlockInfo* block,x86_ptr_imm place)
{
@ -286,6 +287,8 @@ void CheckBlock(RuntimeBlockInfo* block,x86_ptr_imm place)
}
}
void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool staging,bool optimise)
{
//initialise stuff
@ -305,7 +308,11 @@ void ngen_Compile(RuntimeBlockInfo* block,bool force_checks, bool reset, bool st
x86e->Emit(op_add32,&memops_t,block->memops);
x86e->Emit(op_add32,&memops_l,block->linkedmemops);
#ifdef MIPS_COUNTER
x86e->Emit(op_add32, &mips_counter, block->oplist.size());
#endif
//run register allocator
reg.DoAlloc(block,alloc_regs,xmm_alloc_regs);