From 783249a7da83ed6eec62935d8ba7431d7cce652c Mon Sep 17 00:00:00 2001 From: qbix79 Date: Wed, 21 Jan 2015 20:50:40 +0000 Subject: [PATCH] Workaround clang confusing itself (compile error), results in a small speed up in general (thanks for helping wjp). clang compiled x64 dynrec core appears to be unstable though. (-O0 seems to help) git-svn-id: http://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3894 ed541006-0bf7-43e9-8c4d-6fc63c346d47 --- src/cpu/core_dynrec/risc_x64.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h index 58f9d2e..0f1d949 100644 --- a/src/cpu/core_dynrec/risc_x64.h +++ b/src/cpu/core_dynrec/risc_x64.h @@ -85,7 +85,8 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) { static INLINE void gen_reg_memaddr(HostReg reg,void* data) { Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+5); - if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { +// if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { //clang messes itself up on this... + if ( (diff>>63) == (diff>>31) ) { //signed bit extend, test to see if value fits in a Bit32s cache_addb(0x05+(reg<<3)); // RIP-relative addressing is offset after the instruction cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); @@ -100,7 +101,8 @@ static INLINE void gen_reg_memaddr(HostReg reg,void* data) { static INLINE void gen_memaddr(Bitu op,void* data,Bitu off) { Bit64s diff; diff = (Bit64s)data-((Bit64s)cache.pos+off+5); - if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { +// if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { + if ( (diff>>63) == (diff>>31) ) { // RIP-relative addressing is offset after the instruction cache_addb(op+1); cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); -- 2.7.0