Comparison; Compare And Conditional Compare - Intel i960 Jx Developer's Manual

Microprocessor
Table of Contents

Advertisement

INSTRUCTION SET OVERVIEW
5.2.6

Comparison

The processor provides several types of instructions for comparing two operands, as described in
the following subsections.
5.2.6.1

Compare and Conditional Compare

These instructions compare two operands then set the condition code bits in the AC register
according to the results of the comparison:
cmpi
Compare Integer
cmpib
Compare Integer Byte
cmpis
Compare Integer Short
cmpo
Compare Ordinal
concmpi
Conditional Compare Integer
concmpo
Conditional Compare Ordinal
chkbit
Check Bit
These all use the REG format and can specify literals or local or global registers. The condition
code bits are set to indicate whether one operand is less than, equal to, or greater than the other
operand. See
section 3.7.2, "Arithmetic Controls (AC) Register" (pg. 3-18)
condition codes for conditional operations.
and
simply compare the two operands and set the condition code bits accordingly.
cmpi
cmpo
concmpi
and
concmpo
first check the status of condition code bit 2:
When not set, the operands are compared as with
When set, no comparison is performed and the condition code flags are not changed.
The conditional-compare instructions are provided specifically to optimize two-sided range
comparisons to check when A is between B and C (i.e., B
(
cmpi
or
cmpo
) checks one side of the range (e.g., A
(
or
) checks the other side (e.g., A
concmpi
concmpo
comparison. The condition codes following the conditional comparison directly reflect the results
of both comparison operations. Therefore, only one conditional branch instruction is required to
act upon the range check; otherwise, two branches would be needed.
checks a specified bit in a register and sets the condition code flags according to the bit
chkbit
state. The condition code is set to 010
5-12
and
cmpi
cmpo
A
B) and a conditional compare instruction
C) according to the result of the first
when the bit is set and 000
2
for a description of the
.
C). Here, a compare instruction
otherwise.
2

Advertisement

Table of Contents
loading

Table of Contents