Unformatted text preview: ferent control constructs of C are implemented with them. 3.6.1 Condition Codes
In addition to the integer registers, the CPU maintains a set of single-bit condition code registers describing attributes of the most recent arithmetic or logical operation. These registers can then be tested to perform conditional branches. The most useful condition codes are: CF: Carry Flag. The most recent operation generated a carry out of the most signiﬁcant bit. Used to detect overﬂow for unsigned operations.
This instruction is called cdq in the Intel documentation, one of the few cases where the GAS name for an instruction bears no relation to the Intel name.
1 3.6. CONTROL
ZF: Zero Flag. The most recent operation yielded zero. SF: Sign Flag. The most recent operation yielded a negative value. 111 OF: Overﬂow Flag. The most recent operation caused a two’s complement overﬂow—either negative or positive. For example, suppose we used the addl instruction to perform the equivalent of the C expression t=a+b, where variables a...
View Full Document