MIPS - Floating Point Instructions
Floating Point Operations are done within coprocessor1. It has it's own registers $f0-$f31.
Instruction Operands Type Precision Description
abs.d fd, fs Normal double fd <-- absolute value of fs abs.s fd, fs Normal single fd <-- absolute value of fs add.d fd, fs, ft Normal double fd <-- fs + ft
add.s fd, fs, ft Normal single fd <-- fs + ft
bc1t target Normal IF (fp-condition-flag == TRUE) THEN GOTO target bc1f target Normal IF (fp-condition-flag == FALSE) THEN GOTO target c.eq.d fs, ft Normal double IF (fs == ft) THEN fp-condition-flag = true
ELSE fp-condition-flag = false
(use bc1t or bc1f to read the fp-condition-flag) c.eq.s fs, ft Normal single IF (fs == ft) THEN fp-condition-flag = true
ELSE fp-condition-flag = false
(use bc1t or bc1f to read the fp-condition-flag) c.le.d fs, ft Normal double IF (fs <= ft) THEN fp-condition-flag = true
ELSE fp-condition-flag = false
c.le.s fs, ft Normal single IF (fs <= ft) THEN fp-condition-flag = true ELSE fp-condition-flag = false
c.lt.d fs, ft Normal double IF (fs < ft) THEN fp-condition-flag = true ELSE fp-condition-flag = false
c.lt.s fs, ft Normal single IF (fs < ft) THEN fp-condition-flag = true ELSE fp-condition-flag = false
cvt.d.s fd, fs Normal double fd <-- Convert single in fs to double cvt.d.w fd, fs Normal double fd <-- Convert integer in fs to double cvt.s.d fd, fs Normal single fd <-- Convert double in fs to single cvt.s.w fd, fs Normal single fd <-- Convert integer in fs to single cvt.w.d fd, fs Normal integer fd <-- Convert double in fs to integer cvt.w.s fd, fs Normal integer fd <-- Convert single in fs to integer div.d fd, fs, ft Normal double fd <-- fs / ft
div.s fd, fs, ft Normal single fd <-- fs / ft
l.d fd, addr pseudo double load double at addr into register fd l.s fd, addr pseudo single load single at addr into register fd
li.d fd, float pseudo double load immediate double value into register fd li.s fd, float pseudo single load immediate single value into register fd mov.d fd, fs Normal double fd <-- fs
mov.s fd, fs Normal single fd <-- fs mul.d fd, fs, ft Normal double fd <-- fs * ft mul.s fd, fs, ft Normal single fd <-- fs * ft
mfc1 d, fs Normal Move coprocessor1 register fs to CPU register d mtc1 s, fd Normal Move CPU register s to coprocessor1 register fd neg.d fd, fs Normal double fd <-- fs * -1
neg.s fd, fs Normal single fd <-- fs * -1
s.d fd, addr pseudo double store double in register fd at addr s.s fd, addr pseudo single store single in register fd at addr sub.d fd, fs, ft Normal double fd <-- fs - ft
sub.s fd, fs, ft Normal single fd <-- fs - ft
Floating Point System Calls
Exception Handling
Das Status-Register: Das Cause-Register:
Service Call Code Arguments Results
print float $v0 = 2 $f12 = float (single) print double $v0 = 3 $f12 = double
read float $v0 = 6 $f0: float (single)
read double $v0 = 7 $f0: double