2018-09-05 21:53:38 +00:00
|
|
|
#
|
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
|
2018-09-08 20:42:06 +00:00
|
|
|
.sect .text
|
2018-09-08 20:06:38 +00:00
|
|
|
.define .c_ud_i
|
|
|
|
.c_ud_i:
|
2018-09-05 21:53:38 +00:00
|
|
|
/* Input: f0
|
|
|
|
* Output: r2
|
|
|
|
* Only at and f31 may be used.
|
|
|
|
*/
|
2018-09-08 20:42:06 +00:00
|
|
|
|
|
|
|
ori at, zero, hi[.fd_80000000]
|
|
|
|
ldc1 f31, lo[.fd_80000000] (at)
|
2018-09-05 21:53:38 +00:00
|
|
|
c.le.d 0, f31, f0
|
|
|
|
bc1t toobig
|
|
|
|
nop
|
|
|
|
|
|
|
|
trunc.w.d f0, f0
|
|
|
|
mfc1 r2, f0
|
|
|
|
jr ra
|
|
|
|
nop
|
|
|
|
|
|
|
|
toobig:
|
|
|
|
sub.d f0, f0, f31
|
|
|
|
trunc.w.d f0, f0
|
|
|
|
mfc1 r2, f0
|
|
|
|
addiu r2, r2, 0x8000
|
|
|
|
jr ra
|
|
|
|
nop
|