2022-04-30 23:03:22 +00:00
|
|
|
#include "ultra64/asm.h"
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
.set noreorder
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
.section .data
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
.balign 16
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
DATA(qNaN0x3FFFFF)
|
|
|
|
.word 0x7FBFFFFF
|
|
|
|
ENDDATA(qNaN0x3FFFFF)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
DATA(qNaN0x10000)
|
|
|
|
.word 0x7F810000
|
|
|
|
ENDDATA(qNaN0x10000)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
DATA(sNaN0x3FFFFF)
|
|
|
|
.word 0x7FFFFFFF
|
|
|
|
ENDDATA(sNaN0x3FFFFF)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
.section .text
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
.balign 16
|
|
|
|
|
|
|
|
LEAF(floorf)
|
2020-03-21 02:09:42 +00:00
|
|
|
floor.w.s $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.s.w $f0, $f12
|
|
|
|
END(floorf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(floor)
|
2020-03-21 02:09:42 +00:00
|
|
|
floor.w.d $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.d.w $f0, $f12
|
|
|
|
END(floor)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lfloorf)
|
2020-03-21 02:09:42 +00:00
|
|
|
floor.w.s $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lfloorf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lfloor)
|
2020-03-21 02:09:42 +00:00
|
|
|
floor.w.d $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lfloor)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(ceilf)
|
2020-03-21 02:09:42 +00:00
|
|
|
ceil.w.s $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.s.w $f0, $f12
|
|
|
|
END(ceilf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(ceil)
|
2020-03-21 02:09:42 +00:00
|
|
|
ceil.w.d $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.d.w $f0, $f12
|
|
|
|
END(ceil)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lceilf)
|
2020-03-21 02:09:42 +00:00
|
|
|
ceil.w.s $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lceilf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lceil)
|
2020-03-21 02:09:42 +00:00
|
|
|
ceil.w.d $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lceil)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(truncf)
|
2020-03-21 02:09:42 +00:00
|
|
|
trunc.w.s $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.s.w $f0, $f12
|
|
|
|
END(truncf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(trunc)
|
2020-03-21 02:09:42 +00:00
|
|
|
trunc.w.d $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.d.w $f0, $f12
|
|
|
|
END(trunc)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(ltruncf)
|
2020-03-21 02:09:42 +00:00
|
|
|
trunc.w.s $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(ltruncf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(ltrunc)
|
2020-03-21 02:09:42 +00:00
|
|
|
trunc.w.d $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(ltrunc)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(nearbyintf)
|
2020-03-21 02:09:42 +00:00
|
|
|
round.w.s $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.s.w $f0, $f12
|
|
|
|
END(nearbyintf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(nearbyint)
|
2020-03-21 02:09:42 +00:00
|
|
|
round.w.d $f12, $f12
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.d.w $f0, $f12
|
|
|
|
END(nearbyint)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lnearbyintf)
|
2020-03-21 02:09:42 +00:00
|
|
|
round.w.s $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lnearbyintf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lnearbyint)
|
2020-03-21 02:09:42 +00:00
|
|
|
round.w.d $f4, $f12
|
|
|
|
mfc1 $v0, $f4
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lnearbyint)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(roundf)
|
2020-03-21 02:09:42 +00:00
|
|
|
li.s $f4, 0.5
|
|
|
|
nop
|
|
|
|
add.s $f0, $f12, $f4
|
|
|
|
floor.w.s $f0, $f0
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.s.w $f0, $f0
|
|
|
|
END(roundf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(round)
|
2020-03-21 02:09:42 +00:00
|
|
|
li.d $f4, 0.5
|
|
|
|
nop
|
|
|
|
add.d $f0, $f12, $f4
|
|
|
|
floor.w.d $f0, $f0
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
cvt.d.w $f0, $f0
|
|
|
|
END(round)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lroundf)
|
2020-03-21 02:09:42 +00:00
|
|
|
li.s $f4, 0.5
|
|
|
|
nop
|
|
|
|
add.s $f0, $f12, $f4
|
|
|
|
floor.w.s $f0, $f0
|
|
|
|
mfc1 $v0, $f0
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lroundf)
|
2020-03-21 02:09:42 +00:00
|
|
|
|
2022-04-30 23:03:22 +00:00
|
|
|
LEAF(lround)
|
2020-03-21 02:09:42 +00:00
|
|
|
li.d $f4, 0.5
|
|
|
|
nop
|
|
|
|
add.d $f0, $f12, $f4
|
|
|
|
floor.w.d $f0, $f0
|
|
|
|
mfc1 $v0, $f0
|
|
|
|
jr $ra
|
2022-04-30 23:03:22 +00:00
|
|
|
nop
|
|
|
|
END(lround)
|