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

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

Advertisement

REP/REPE/REPZ/REPNE /REPNZ—Repeat String Operation Prefix
(Continued)
All of these repeat prefixes cause the associated instruction to be repeated until the
count in register ECX is decremented to 0 (see the following table). The REPE, REPNE,
REPZ, and REPNZ prefixes also check the state of the ZF flag after each iteration and
terminate the repeat loop if the ZF flag is not in the specified state. When both
termination conditions are tested, the cause of a repeat termination can be determined
either by testing the ECX register with a JECXZ instruction or by testing the ZF flag with
a JZ, JNZ, and JNE instruction.
Table 2-17.
REP
REPE/REPZ
REPNE/REPNZ
When the REPE/REPZ and REPNE/REPNZ prefixes are used, the ZF flag does not require
initialization because both the CMPS and SCAS instructions affect the ZF flag according
to the results of the comparisons they make.
A repeating string operation can be suspended by an exception or interrupt. When this
happens, the state of the registers is preserved to allow the string operation to be
resumed upon a return from the exception or interrupt handler. The source and
destination registers point to the next string elements to be operated on, the EIP
register points to the string instruction, and the ECX register has the value it held
following the last successful iteration of the instruction. This mechanism allows long
string operations to proceed without affecting the interrupt response time of the
system.
When a page fault occurs during CMPS or SCAS instructions that are prefixed with
REPNE, the EFLAGS value may NOT be restored to the state prior to the execution of
the instruction. Since SCAS and CMPS do not use EFLAGS as an input, the processor
can resume the instruction after the page fault handler.
Use the REP INS and REP OUTS instructions with caution. Not all I/O ports can handle
the rate at which these instructions execute.
A REP STOS instruction is the fastest way to initialize a large block of memory.
Operation
IF AddressSize = 16
THEN
use CX for CountReg;
ELSE (* AddressSize = 32 *)
use ECX for CountReg;
FI;
WHILE CountReg  0
DO
service pending interrupts (if any);
execute associated string instruction;
CountReg  CountReg - 1;
4:338
Repeat Conditions
Repeat Prefix
Termination Condition 1
ECX=0
ECX=0
ECX=0
Volume 4: Base IA-32 Instruction Reference
Termination Condition 2
None
ZF=0
ZF=1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Itanium architecture 2.3

Table of Contents