cmc
Complement Carry Flag
CMC
Toggles the CF flag.
Details
Complements (toggles) the Carry Flag (CF): if CF=0 it becomes 1, and if CF=1 it becomes 0. Only the CF flag is modified; all other flags remain unchanged. Available in all modes (real, protected, and 64-bit).
Pseudocode Operation
CF ← NOT CF
Example
CMC
Encoding
Binary Layout
F5
+0
Operands
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| F5 | CMC | ZO | Valid Valid | Complement CF flag. |
Description
Complements the CF flag in the EFLAGS register. CMC operation is the same in non-64-bit modes and 64-bit mode.
Operation
EFLAGS.CF[bit 0] := NOT EFLAGS.CF[bit 0];
Flags Affected
The CF flag contains the complement of its original value. The OF, ZF, SF, AF, and PF flags are unaffected. Exceptions (All Operating Modes) #UD If the LOCK prefix is used. CMC—Complement Carry Flag Vol. 2A 3-156