From: notaz Date: Fri, 15 Mar 2013 23:53:05 +0000 (+0200) Subject: drc: timing hacks X-Git-Tag: r19~1 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6e87b2bc0963e331971495e91f599115f5442c0;p=pcsx_rearmed.git drc: timing hacks run tiny loops faster, no store penalty --- diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index bab5ec8c..21c96699 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -279,6 +279,8 @@ int tracedebug=0; //#define DEBUG_CYCLE_COUNT 1 +#define NO_CYCLE_PENALTY_THR 12 + int cycle_multiplier; // 100 for 1.0 static int CLOCK_ADJUST(int x) @@ -4981,6 +4983,7 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) int count; int jaddr; int idle=0; + int t=0; if(itype[i]==RJUMP) { *adj=0; @@ -4988,7 +4991,7 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) //if(ba[i]>=start && ba[i]<(start+slen*4)) if(internal_branch(branch_regs[i].is32,ba[i])) { - int t=(ba[i]-start)>>2; + t=(ba[i]-start)>>2; if(is_ds[t]) *adj=-1; // Branch into delay slot adds an extra cycle else *adj=ccadj[t]; } @@ -5007,7 +5010,14 @@ void do_cc(int i,signed char i_regmap[],int *adj,int addr,int taken,int invert) emit_jmp(0); } else if(*adj==0||invert) { - emit_addimm_and_set_flags(CLOCK_ADJUST(count+2),HOST_CCREG); + int cycles=CLOCK_ADJUST(count+2); + // faster loop HACK + if (t&&*adj) { + int rel=t-i; + if(-NO_CYCLE_PENALTY_THR