Data comparison instructions compare two source operands. They can either store the result in a destination operand or use the result to determine the next instruction to be executed. In the latter case, they also serve as sequence control instructions.
Data comparison instructions compare two source operands. The most frequently used data comparison instructions use the result to determine the next instruction to be executed. They also serve as sequence control instructions.
Instruction | Operation | |
---|---|---|
seq | Rd, Rs1, Rcs2 | set true if equal |
sge | Rd, Rs1, Rcs2 | set true if greater or equal |
sgeu | Rd, Rs1, Rcs2 | set true if greater or equal unsigned |
sgt | Rd, Rs1, Rcs2 | set true if greater than |
sgtu | Rd, Rs1, Rcs2 | set true if greater than unsigned |
sle | Rd, Rs1, Rcs2 | set true if less or equal |
sleu | Rd, Rs1, Rcs2 | set true if less or equal unsigned |
slt | Rd, Rs1, Rcs2 | set true if less than |
sltu | Rd, Rs1, Rcs2 | set true if less than unsigned |
sne | Rd, Rs1, Rcs2 | set true if not equal |
All of these instruction set or clear the low order bit of the
destination register.
The bnez
(condition true) and beqz
(condition false) instructions can then be used for branching
conditioned on the comparison result.
The bit manipulation instructions can be used with comparison results to test complicated control structure conditions.
Instruction | Operation | |
---|---|---|
c.eq.d | Fs1, Fs2 | set floating point coprocessor flag true if equal double |
c.eq.s | Fs1, Fs2 | set floating point coprocessor flag true if equal float |
c.ge.d | Fs1, Fs2 | set floating point coprocessor flag true if greater or equal double |
c.ge.s | Fs1, Fs2 | set floating point coprocessor flag true if greater or equal float |
c.gt.d | Fs1, Fs2 | set floating point coprocessor flag true if greater than double |
c.gt.s | Fs1, Fs2 | set floating point coprocessor flag true if greater than float |
c.le.d | Fs1, Fs2 | set floating point coprocessor flag true if less or equal double |
c.le.s | Fs1, Fs2 | set floating point coprocessor flag true if less or equal float |
c.lt.d | Fs1, Fs2 | set floating point coprocessor flag true if less than double |
c.lt.s | Fs1, Fs2 | set floating point coprocessor flag true if less than float |
c.ne.d | Fs1, Fs2 | set floating point coprocessor flag true if not equal double |
c.ne.s | Fs1, Fs2 | set floating point coprocessor flag true if not equal float |
The floating point compare instructions set or clear the floating point
coprocessor flag.
The bc1t
(flag true) and bc1f
(flag false)
instructions can then be used for branching conditioned on the comparison
result.