cld
Clear Direction Flag
CLD
Sets DF to 0 (String operations increment).
Details
Clears the Direction Flag (DF) to 0, causing string instructions (MOVS, SCAS, LODS, STOS, CMPS) to auto-increment the index registers (ESI/EDI or RSI/RDI) rather than decrement them. Only DF is modified; all other flags remain unchanged. Available in all modes.
Pseudocode Operation
DF ← 0
Example
CLD
Encoding
Binary Layout
FC
+0
Operands
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| FC | CLD | ZO | Valid Valid | Clear DF flag. |
Description
Clears the DF flag in the EFLAGS register. When the DF flag is set to 0, string operations increment the index registers (ESI and/or EDI). Operation is the same in all modes.
Operation
DF := 0;
Flags Affected
The DF flag is set to 0. The CF, OF, ZF, SF, AF, and PF flags are unaffected. Exceptions (All Operating Modes) #UD If the LOCK prefix is used. CLD—Clear Direction Flag Vol. 2A 3-141