diff options
| author | pierre <pierre@pirsoft.de> | 2010-12-29 02:12:06 +0000 |
|---|---|---|
| committer | pierre <pierre@pirsoft.de> | 2010-12-29 02:12:06 +0000 |
| commit | fc1db5eaa0b6caf2797d6250fa7a7bce1cfe4dbe (patch) | |
| tree | b652d2cdcd5f5d33a5f70164abd787f698d9c606 /Source/Core/Common | |
| parent | 0059b0f44f6af976fa1b17cea932b3d828d58e3c (diff) | |
Core/DSPCore: Reorganize register layout for accessing accumulators
(acc and ax) and product register with one read/write.
Gives a minuscule speedup of not more than 4%. In exchange, breaks all
your out-of-tree changes to dsp. Tests are not building again, yet.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6680 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/x64Emitter.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index 2df9274468..182cde1cf3 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -187,6 +187,24 @@ inline OpArg ImmPtr(void* imm) {return Imm64((u64)imm);} #else inline OpArg ImmPtr(void* imm) {return Imm32((u32)imm);} #endif +inline u32 PtrOffset(void* ptr, void* base) { +#ifdef _M_X64 + s64 distance = (s64)ptr-(s64)base; + if (distance >= 0x80000000LL || + distance < -0x80000000LL) { + _assert_msg_(DYNA_REC, 0, "pointer offset out of range"); + return 0; + } + return distance; +#else + return (u32)ptr-(u32)base; +#endif +} + +//usage: int a[]; ARRAY_OFFSET(a,10) +#define ARRAY_OFFSET(array,index) ((u64)&(array)[index]-(u64)&(array)[0]) +//usage: struct {int e;} s; STRUCT_OFFSET(s,e) +#define STRUCT_OFFSET(str,elem) ((u64)&(str).elem-(u64)&(str)) struct FixupBranch { |
