From: David Given Date: Wed, 12 Sep 2018 20:28:40 +0000 (+0200) Subject: Make sure li works properly when loading fixed up values which end up as 0. Use X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8105281534e29d071f2ad228705114faeb45d092;p=ack.git Make sure li works properly when loading fixed up values which end up as 0. Use lui rather than li to load high values. --- diff --git a/mach/mips/as/mach4.c b/mach/mips/as/mach4.c index 6208fff9d..443ca1e49 100644 --- a/mach/mips/as/mach4.c +++ b/mach/mips/as/mach4.c @@ -4,9 +4,7 @@ word_t reg = $2; word_t val = $4; - if (val == 0) - emit4(0x00000025 | (reg<<11)); /* or reg, zero, zero */ - else if ((val < -0x8000) || (val > 0xffff)) + if ((val < -0x8000) || (val > 0xffff)) emit4(0x24000000 | (reg<<16) | (val & 0xffff)); /* addiu reg, zero, value */ else { diff --git a/mach/mips/libem/c_ud_i.s b/mach/mips/libem/c_ud_i.s index 5af88483d..2d2ba6992 100644 --- a/mach/mips/libem/c_ud_i.s +++ b/mach/mips/libem/c_ud_i.s @@ -9,7 +9,7 @@ * Only at and f30/f31 may be used. */ - li at, ha16[.fd_80000000] + lui at, ha16[.fd_80000000] ldc1 f30, lo16[.fd_80000000] (at) c.le.d 0, f30, f0 bc1t toobig diff --git a/mach/mips/libem/c_uf_i.s b/mach/mips/libem/c_uf_i.s index 1a3c2a1f7..0677456ae 100644 --- a/mach/mips/libem/c_uf_i.s +++ b/mach/mips/libem/c_uf_i.s @@ -12,7 +12,7 @@ * Only at and f30/f31 may be used. */ - li at, ha16[.ff_80000000] + lui at, ha16[.ff_80000000] lwc1 f30, lo16[.ff_80000000] (at) c.le.s 0, f30, f0 bc1t toobig diff --git a/mach/mips/libem/c_ui_d.s b/mach/mips/libem/c_ui_d.s index ef987d50d..0432d9074 100644 --- a/mach/mips/libem/c_ui_d.s +++ b/mach/mips/libem/c_ui_d.s @@ -13,7 +13,7 @@ bgez r2, nonnegative nop - li at, ha16[.fd_100000000] + lui at, ha16[.fd_100000000] ldc1 f30, lo16[.fd_100000000] (at) add.d f0, f0, f30 nonnegative: diff --git a/mach/mips/libem/c_ui_f.s b/mach/mips/libem/c_ui_f.s index f54179fb8..e22745afb 100644 --- a/mach/mips/libem/c_ui_f.s +++ b/mach/mips/libem/c_ui_f.s @@ -13,7 +13,7 @@ bgez r2, nonnegative nop - li at, ha16[.fs_100000000] + lui at, ha16[.fs_100000000] ldc1 f30, lo16[.fs_100000000] (at) add.d f0, f0, f30 nonnegative: diff --git a/mach/mips/libem/fif8.s b/mach/mips/libem/fif8.s index 6b18ee746..e03812b4b 100644 --- a/mach/mips/libem/fif8.s +++ b/mach/mips/libem/fif8.s @@ -16,7 +16,7 @@ mul.d f0, f0, f2 ! f0 = a * b abs.d f2, f0 ! f2 = abs(f0) - li at, ha16[max_power_of_two] + lui at, ha16[max_power_of_two] ldc1 f4, lo16[max_power_of_two] (at) ! f4 = max power of two mov.d f6, f2 ! we're going to assemble the integer part in f6 @@ -31,7 +31,7 @@ ! The above might round, so correct that. - li at, ha16[one] + lui at, ha16[one] ldc1 f8, lo16[one] (at) ! f8 = 1.0 1: c.le.d 0, f6, f2 ! if result <= absolute value, stop