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

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

Advertisement

SCAS/SCASB/SCASW/SCASD—Scan String Data
Opcode
AE
AF
AF
AE
AF
AF
Description
Compares the byte, word, or double word specified with the source operand with the
value in the AL, AX, or EAX register, respectively, and sets the status flags in the
EFLAGS register according to the results. The source operand specifies the memory
location at the address ES:EDI. (When the operand-size attribute is 16, the DI register
is used as the source-index register.) The ES segment cannot be overridden with a
segment override prefix.
The SCASB, SCASW, and SCASD mnemonics are synonyms of the byte, word, and
doubleword versions of the SCAS instructions. They are simpler to use, but provide no
type or segment checking. (For the SCAS instruction, "ES:EDI" must be explicitly
specified in the instruction.)
After the comparison, the EDI register is incremented or decremented automatically
according to the setting of the DF flag in the EFLAGS register. (If the DF flag is 0, the
EDI register is incremented; if the DF flag is 1, the EDI register is decremented.) The
EDI register is incremented or decremented by 1 for byte operations, by 2 for word
operations, or by 4 for doubleword operations.
The SCAS, SCASB, SCASW, and SCASD 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. See
"REP/REPE/REPZ/REPNE /REPNZ—Repeat String Operation Prefix" on page 4:337
description of the REP prefix.
Operation
IF (byte cmparison)
THEN
temp  AL  SRC;
SetStatusFlags(temp);
ELSE IF (word comparison)
THEN
4:354
Instruction
SCAS ES:(E)DI
SCAS ES:DI
SCAS ES:EDI
SCASB
SCASW
SCASD
THEN IF DF = 0
THEN (E)DI  1;
ELSE (E)DI  -1;
FI;
temp  AX  SRC;
SetStatusFlags(temp)
THEN IF DF = 0
Description
Compare AL with byte at ES:(E)DI and set status flags
Compare AX with word at ES:DI and set status flags
Compare EAX with doubleword at ES:EDI and set status flags
Compare AL with byte at ES:(E)DI and set status flags
Compare AX with word at ES:DI and set status flags
Compare EAX with doubleword at ES:EDI and set status flags
Volume 4: Base IA-32 Instruction Reference
for a

Advertisement

Table of Contents
loading

This manual is also suitable for:

Itanium architecture 2.3

Table of Contents