From: Rune Holm Date: Fri, 18 Jun 2021 18:51:46 +0000 (+0100) Subject: optimise away an unnecessary subtract on the instruction fetch fast path X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b91e0e809dc3f63691adf6b4e94afde93100bd0b;p=pistorm optimise away an unnecessary subtract on the instruction fetch fast path --- diff --git a/m68kcpu.c b/m68kcpu.c index da84aed..bdcb103 100644 --- a/m68kcpu.c +++ b/m68kcpu.c @@ -1265,7 +1265,7 @@ uint m68ki_read_imm6_addr_slowpath(uint32_t pc, address_translation_cache *cache if(address >= read_addr[i] && address < read_upper[i]) { cache->lower = read_addr[i] + pc_address_diff; cache->upper = read_upper[i] + pc_address_diff; - cache->data = read_data[i]; + cache->offset = read_data[i] - cache->lower; REG_PC += 2; return be16toh(((unsigned short *)(read_data[i] + (address - read_addr[i])))[0]); } diff --git a/m68kcpu.h b/m68kcpu.h index ef25ad1..d943f94 100644 --- a/m68kcpu.h +++ b/m68kcpu.h @@ -1079,7 +1079,7 @@ typedef struct { unsigned int lower; unsigned int upper; - unsigned char *data; + unsigned char *offset; } address_translation_cache; @@ -1173,7 +1173,7 @@ static inline uint m68ki_read_imm_16(void) if(pc >= cache->lower && pc < cache->upper) { REG_PC += 2; - return be16toh(((unsigned short *)(cache->data + (pc - cache->lower)))[0]); + return be16toh(((unsigned short *)(cache->offset + pc))[0]); } return m68ki_read_imm6_addr_slowpath(pc, cache); }