From 2434d0183e8d06f36b1c10c70432d9248d4c44fa Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Tue, 14 May 2019 12:38:56 +0200 Subject: [PATCH] wince: better sh4 instr cycle counting. Don't hash blocks if mmu on Use actual instr latency cycles, including fp instr Decrease the WinCE boost ratio to 1.2 Don't hash blocks when mmu on --- core/hw/sh4/dyna/decoder.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/hw/sh4/dyna/decoder.cpp b/core/hw/sh4/dyna/decoder.cpp index e50f29953..6b93623df 100644 --- a/core/hw/sh4/dyna/decoder.cpp +++ b/core/hw/sh4/dyna/decoder.cpp @@ -1072,10 +1072,17 @@ bool dec_DecodeBlock(RuntimeBlockInfo* rbi,u32 max_cycles) else { blk->guest_opcodes++; - if (op>=0xF000) - blk->guest_cycles+=0; + if (!mmu_enabled()) + { + if (op>=0xF000) + blk->guest_cycles+=0; + else + blk->guest_cycles+=CPU_RATIO; + } else - blk->guest_cycles+=CPU_RATIO; + { + blk->guest_cycles += max((int)OpDesc[op]->LatencyCycles, 1); + } if (OpDesc[op]->IsFloatingPoint()) { if (sr.FD == 1) @@ -1158,7 +1165,7 @@ _end: if (settings.dynarec.idleskip) { //Experimental hash-id based idle skip - if (strstr(idle_hash,blk->hash(false,true))) // FIXME don't hash temp blocks. Use xxhash instead of sha1 + if (!mmu_enabled() && strstr(idle_hash,blk->hash(false,true))) // FIXME Use xxhash instead of sha1 { //printf("IDLESKIP: %08X reloc match %s\n",blk->addr,blk->hash(false,true)); blk->guest_cycles=max_cycles*100; @@ -1203,7 +1210,7 @@ _end: } // Win CE boost if (mmu_enabled()) - blk->guest_cycles *= 2; + blk->guest_cycles *= 1.2f; //make sure we don't use wayy-too-many cycles blk->guest_cycles=min(blk->guest_cycles,max_cycles);