CMP2

CMP2

Operation:
Compare Rn < lower bound or
Rn > upper bound
and Set Condition Codes

Compatibility: MC68020/MC68030/MC68040

Assembler Syntax:
CMP2 <ea>, Rn

Attributes: Size = (Byte, Word, Long)

Description: Compares the value in Rn to each bound. The
effective address contains the bounds pair: the lower bound
followed by the upper bound. For signed comparisons, the
arithmetically smaller value should be used as the lower
bound. For unsigned comparisons, the logically smaller
value should be the lower bound.

The size of the data and the bounds can be specified as byte,
word, or long. If Rn is a data register and operation size
is a byte or word, only the appropriate low-order part of
Rn is checked. If Rn is an address register and the operation
size is byte or word, the bounds operands are sign extended
to 32 bits and the resultant operands are compared to the full
32 bits of An.

If the upper bound equals the lower bound, the valid range
is a single value.

Condition Codes:
\c34242
X Not affected.
N Undefined.
Z Set if Rn is equal to either bound. Cleared otherwise.
V Undefined.
C Set if Rn is out of bounds. Cleared otherwise.

Instruction Format:
\i2-----2Size,-++u6Effective Address,3Mode,3Reg,1DA,3Reg,------------

Instruction Fields:
Size field -- Specifies the size of the operation.
00 -- Byte operation.
01 -- Word operation.
10 -- Long operation.
Effective Address field -- Specifies the location of the bounds
operands. Only control addressing modes are allowed as
shown:
\m27B

DA field -- Specifies whether an address register or data register
is to be checked.
0 -- Data register.
1 -- Address register.
Register field -- Specifies the address or data register that
contains the value to be checked.

Related Instructions:
CMP,433
CMPA,434
CMPI,435
CMPM,436
.436438