The condition bit is like a one bit register.
It continues to hold the value put into it by a comparison instruction until
another comparison instruction is executed.
The following code ensures that register
has the minimum of
If they are equal, then
$f12 gets the value they both contain.
main: l.s $f0,A # get the values l.s $f2,B # into registers c.lt.s $f0,$f2 # is A < B? mov.s $f12,$f0 # move A to $f12 # (condition bit continues to hold # its value) bc1t common # otherwise mov.s $f12,$f2 # move B to $f12 common:
The above code is contrived; it would be better to reverse the third and fourth statements. However, sometimes it is very useful to hold the condition bit's value for several instructions before using it.
(Review: ) should
c.eq.s be used to
implement a while loop?