lui rather than li to load high values.
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
{
* 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
* 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
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:
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:
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
! 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