Make sure li works properly when loading fixed up values which end up as 0. Use

lui rather than li to load high values.
This commit is contained in:
David Given 2018-09-12 22:28:40 +02:00
parent a8df9721d3
commit 8105281534
6 changed files with 7 additions and 9 deletions

View 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
{

View 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

View 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

View 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:

View 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:

View 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