ack/mach/mips/libem/c_uf_i.s
David Given e88670dad4 Yikes! Turns out that FPU registers are only 32 bits wide, and doubles are
stored in pairs, just like on the PowerPC!
2018-09-09 18:25:00 +02:00

34 lines
402 B
ArmAsm

#
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
.define .c_uf_i
.c_uf_i:
/* Input: f0
* Output: r2
* Only at and f30/f31 may be used.
*/
ori at, zero, hi16[.ff_80000000]
lwc1 f30, lo16[.ff_80000000] (at)
c.le.s 0, f30, f0
bc1t toobig
nop
trunc.w.s f0, f0
mfc1 r2, f0
jr ra
nop
toobig:
sub.s f0, f0, f30
trunc.w.s f0, f0
mfc1 r2, f0
addiu r2, r2, 0x8000
jr ra
nop