From: kub Date: Mon, 28 Jun 2021 19:31:32 +0000 (+0200) Subject: sh2 drc, fix arm32 ld/st offset (minimum -255) X-Git-Tag: v2.00~506 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d8357dded199d306a823c06c9f2903d40f7c46f;p=picodrive.git sh2 drc, fix arm32 ld/st offset (minimum -255) --- diff --git a/cpu/sh2/compiler.c b/cpu/sh2/compiler.c index 549e4763..66400c77 100644 --- a/cpu/sh2/compiler.c +++ b/cpu/sh2/compiler.c @@ -2611,6 +2611,14 @@ static uptr split_address(uptr la, uptr mask, s32 *offs) uptr sign = (mask>>1) + 1; // sign bit in offset *offs = (la & mask) | (la & sign ? ~mask : 0); // offset part, sign extended la = (la & ~mask) + ((la & sign) << 1); // base part, corrected for offs sign +#ifdef __arm__ + // arm32 offset has an add/sub flag and an unsigned 8 bit value, which only + // allows values of [-255...255]. the value -256 thus can't be used. + if (*offs + sign == 0) { + la += sign; + *offs += sign; + } +#endif return la; }