## Floating Point Instructions

The MIPS has a floating point coprocessor (numbered 1) that operates on single precision (32-bit) and double precision (64-bit) floating point numbers. This coprocessor has its own registers, which are numbered $f0-$f31. Because these registers are only 32-bits wide, two of them are required to hold doubles. To simplify matters, floating point operations only use even-numbered registers--including instructions that operate on single floats.

Values are moved in or out of these registers a word (32-bits) at a time by lwc1, swc1, mtc1, and mfc1 instructions described above or by the l.s, l.d, s.s, and s.d pseudoinstructions described below. The flag set by floating point comparison operations is read by the CPU with its bc1t and bc1f instructions.

In all instructions below, FRdest, FRsrc1, FRsrc2, and FRsrc are floating point registers (e.g., \$f2).

abs.d FRdest, FRsrcFloating Point Absolute Value Double
abs.s FRdest, FRsrcFloating Point Absolute Value Single
Compute the absolute value of the floating float double (single) in register FRsrc and put it in register FRdest.

Compute the sum of the floating float doubles (singles) in registers FRsrc1 and FRsrc2 and put it in register FRdest.

c.eq.d FRsrc1, FRsrc2Compare Equal Double
c.eq.s FRsrc1, FRsrc2Compare Equal Single
Compare the floating point double in register FRsrc1 against the one in FRsrc2 and set the floating point condition flag true if they are equal.

c.le.d FRsrc1, FRsrc2Compare Less Than Equal Double
c.le.s FRsrc1, FRsrc2Compare Less Than Equal Single
Compare the floating point double in register FRsrc1 against the one in FRsrc2 and set the floating point condition flag true if the first is less than or equal to the second.

c.lt.d FRsrc1, FRsrc2Compare Less Than Double
c.lt.s FRsrc1, FRsrc2Compare Less Than Single
Compare the floating point double in register FRsrc1 against the one in FRsrc2 and set the condition flag true if the first is less than the second.

cvt.d.s FRdest, FRsrcConvert Single to Double
cvt.d.w FRdest, FRsrcConvert Integer to Double
Convert the single precision floating point number or integer in register FRsrc to a double precision number and put it in register FRdest.

cvt.s.d FRdest, FRsrcConvert Double to Single
cvt.s.w FRdest, FRsrcConvert Integer to Single
Convert the double precision floating point number or integer in register FRsrc to a single precision number and put it in register FRdest.

cvt.w.d FRdest, FRsrcConvert Double to Integer
cvt.w.s FRdest, FRsrcConvert Single to Integer
Convert the double or single precision floating point number in register FRsrc to an integer and put it in register FRdest.

div.d FRdest, FRsrc1, FRsrc2Floating Point Divide Double
div.s FRdest, FRsrc1, FRsrc2Floating Point Divide Single
Compute the quotient of the floating float doubles (singles) in registers FRsrc1 and FRsrc2 and put it in register FRdest.

mov.d FRdest, FRsrcMove Floating Point Double
mov.s FRdest, FRsrcMove Floating Point Single
Move the floating float double (single) from register FRsrc to register FRdest.

mul.d FRdest, FRsrc1, FRsrc2Floating Point Multiply Double
mul.s FRdest, FRsrc1, FRsrc2Floating Point Multiply Single
Compute the product of the floating float doubles (singles) in registers FRsrc1 and FRsrc2 and put it in register FRdest.

neg.d FRdest, FRsrcNegate Double
neg.s FRdest, FRsrcNegate Single
Negate the floating point double (single) in register FRsrc and put it in register FRdest.

s.d FRdest, addressStore Floating Point Double
s.s FRdest, addressStore Floating Point Single
Store the floating float double (single) in register FRdest at address.

sub.d FRdest, FRsrc1, FRsrc2Floating Point Subtract Double
sub.s FRdest, FRsrc1, FRsrc2Floating Point Subtract Single
Compute the difference of the floating float doubles (singles) in registers FRsrc1 and FRsrc2 and put it in register FRdest.

Ian Moor 2009-03-11