mirror of https://github.com/mgba-emu/mgba.git
Attempt to stabilize PPC asm across compilers
This commit is contained in:
parent
43e5aa698a
commit
d1f8e58b13
|
@ -18,23 +18,27 @@
|
|||
|
||||
#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]
|
||||
|
|
Loading…
Reference in New Issue