Intel ITANIUM ARCHITECTURE - SOFTWARE DEVELOPERS MANUAL VOLUME 1 REV 2.3 Manual page 1373

Hide thumbs Also See for ITANIUM ARCHITECTURE - SOFTWARE DEVELOPERS MANUAL VOLUME 1 REV 2.3:
Table of Contents

Advertisement

CMPS/CMPSB/CMPSW/CMPSD—Compare String Operands
Opcode
A6
A7
A7
A6
A7
A7
Description
Compares the byte, word, or double word specified with the first source operand with
the byte, word, or double word specified with the second source operand and sets the
status flags in the EFLAGS register according to the results. The first source operand
specifies the memory location at the address DS:ESI and the second source operand
specifies the memory location at address ES:EDI. (When the operand-size attribute is
16, the SI and DI register are used as the source-index and destination-index registers,
respectively.) The DS segment may be overridden with a segment override prefix, but
the ES segment cannot be overridden.
The CMPSB, CMPSW, and CMPSD mnemonics are synonyms of the byte, word, and
doubleword versions of the CMPS instructions. They are simpler to use, but provide no
type or segment checking. (For the CMPS instruction, "DS:ESI" and "ES:EDI" must be
explicitly specified in the instruction.)
After the comparison, the ESI and EDI registers are incremented or decremented
automatically according to the setting of the DF flag in the EFLAGS register. (If the DF
flag is 0, the ESI and EDI register are incremented; if the DF flag is 1, the ESI and EDI
registers are decremented.) The registers are incremented or decremented by 1 for
byte operations, by 2 for word operations, or by 4 for doubleword operations.
The CMPS, CMPSB, CMPSW, and CMPSD instructions can be preceded by the REP prefix
for block comparisons of ECX bytes, words, or doublewords. More often, however, these
instructions will be used in a LOOP construct that takes some action based on the
setting of the status flags before the next comparison is made.
Volume 4: Base IA-32 Instruction Reference
Instruction
CMPS DS:(E)SI, ES:(E)DI
CMPS DS:SI, ES:DI
CMPS DS:ESI, ES:EDI
CMPSB
CMPSW
CMPSD
Description
Compares byte at address DS:(E)SI with byte at address
ES:(E)DI and sets the status flags accordingly
Compares byte at address DS:SI with byte at address
ES:DI and sets the status flags accordingly
Compares byte at address DS:ESI with byte at address
ES:EDI and sets the status flags accordingly
Compares byte at address DS:(E)SI with byte at address
ES:(E)DI and sets the status flags accordingly
Compares byte at address DS:SI with byte at address
ES:DI and sets the status flags accordingly
Compares byte at address DS:ESI with byte at address
ES:EDI and sets the status flags accordingly
4:71

Advertisement

Table of Contents
loading

This manual is also suitable for:

Itanium architecture 2.3

Table of Contents