The neg.s fd,fs
instruction toggles
the sign bit of the float in $fs
when it
copies the pattern to $fd
.
Here is a program that serves no practical purpose except as an example. The program loads a general purpose register with a two's complement 1 and copies that pattern to a floating point register. Then it loads a floating point register with an IEEE 1.0 and moves that pattern to a general purpose register.
## Move data between the coprocessor and the CPU .text .globl main main: li $t0,1 # $t0 <-- 1 # (move to the coprocessor) mtc1 $t0,$f0 # $f0 <-- $t0 li.s $f1,1.0 # $f1 <-- 1.0 # (move from the coprocessor) mfc1 $t1,$f1 # $t1 <-- $f1 li $v0,10 # exit syscall
Here is what the SPIM registers contain after running the program:
Could floating point arithmetic be done with the
value in register $f0
?