all repos — mgba @ d1f8e58b131e39a6dc67b7fe26499ad900c7c821

mGBA Game Boy Advance Emulator

Attempt to stabilize PPC asm across compilers
Jeffrey Pfau jeffrey@endrift.com
Wed, 01 Oct 2014 12:41:51 +0000
commit

d1f8e58b131e39a6dc67b7fe26499ad900c7c821

parent

43e5aa698afab3c97121b6ebb4a2e10fd394d483

1 files changed, 12 insertions(+), 8 deletions(-)

jump to
M src/arm/common.hsrc/arm/common.h

@@ -18,23 +18,27 @@ #define UNUSED(V) (void)(V)

#if defined(__PPC__) || defined(__POWERPC__) #define LOAD_32(DEST, ADDR, ARR) { \ - uint32_t _tmp = (ADDR); \ - asm("lwbrx %0, %1, %2" : "=r"(DEST) : "r"(_tmp), "p"(ARR)); \ + uint32_t _addr = (ADDR); \ + void* _ptr = (ARR); \ + asm("lwbrx %0, %1, %2" : "=r"(DEST) : "b"(_ptr), "r"(_addr)); \ } #define LOAD_16(DEST, ADDR, ARR) { \ - uint32_t _tmp = (ADDR); \ - asm("lhbrx %0, %1, %2" : "=r"(DEST) : "r"(_tmp), "p"(ARR)); \ + uint32_t _addr = (ADDR); \ + void* _ptr = (ARR); \ + asm("lhbrx %0, %1, %2" : "=r"(DEST) : "b"(_ptr), "r"(_addr)); \ } #define STORE_32(SRC, ADDR, ARR) { \ - uint32_t _tmp = (ADDR); \ - asm("stwbrx %0, %1, %2" : : "r"(SRC), "r"(_tmp), "p"(ARR)); \ + uint32_t _addr = (ADDR); \ + void* _ptr = (ARR); \ + asm("stwbrx %0, %1, %2" : : "r"(SRC), "b"(_ptr), "r"(_addr)); \ } #define STORE_16(SRC, ADDR, ARR) { \ - uint32_t _tmp = (ADDR); \ - asm("sthbrx %0, %1, %2" : : "r"(SRC), "r"(_tmp), "p"(ARR)); \ + uint32_t _addr = (ADDR); \ + void* _ptr = (ARR); \ + asm("sthbrx %0, %1, %2" : : "r"(SRC), "b"(_ptr), "r"(_addr)); \ } #else #define LOAD_32(DEST, ADDR, ARR) DEST = ((uint32_t*) ARR)[(ADDR) >> 2]