Make sure li works properly when loading fixed up values which end up as 0. Use
authorDavid Given <dg@cowlark.com>
Wed, 12 Sep 2018 20:28:40 +0000 (22:28 +0200)
committerDavid Given <dg@cowlark.com>
Wed, 12 Sep 2018 20:28:40 +0000 (22:28 +0200)
lui rather than li to load high values.

mach/mips/as/mach4.c
mach/mips/libem/c_ud_i.s
mach/mips/libem/c_uf_i.s
mach/mips/libem/c_ui_d.s
mach/mips/libem/c_ui_f.s
mach/mips/libem/fif8.s

index 6208fff..443ca1e 100644 (file)
@@ -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
                {
index 5af8848..2d2ba69 100644 (file)
@@ -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
index 1a3c2a1..0677456 100644 (file)
@@ -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
index ef987d5..0432d90 100644 (file)
@@ -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:
index f54179f..e22745a 100644 (file)
@@ -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:
index 6b18ee7..e03812b 100644 (file)
@@ -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