You copied the Doc URL to your clipboard.

Carry flag

The carry (C) flag is set when an operation results in a carry, or when a subtraction results in no borrow.

In A32/T32 code, C is set in one of the following ways:

  • For an addition,including the comparison instruction CMN,C is set to 1 if the addition produced a carry (that is, an unsignedoverflow), and to 0 otherwise.
  • For a subtraction, including the comparison instruction CMP,C is set to 0 if the subtraction produced a borrow (that is, anunsigned underflow), and to 1 otherwise.
  • For non-additions/subtractions that incorporatea shift operation, C is set to the last bit shifted out of the valueby the shifter.
  • For other non-additions/subtractions, C is normallyleft unchanged, but see the individual instruction descriptionsfor any special cases.
  • The floating-point compare instructions, VCMP and VCMPE setthe C flag and the other condition flags in the FPSCR to the resultof the comparison.

In A64 code, C is set in one of the following ways:

  • For an addition,including the comparison instruction CMN,C is set to 1 if the addition produced a carry (that is, an unsignedoverflow), and to 0 otherwise.
  • For a subtraction, including the comparison instruction CMP andthe negate instructions NEGS and NGCS,C is set to 0 if the subtraction produced a borrow (that is, anunsigned underflow), and to 1 otherwise.
  • For the integer and floating-point conditional compareinstructions CCMP, CCMN, FCCMP,and FCCMPE, C and the other conditionflags are set either to the result of the comparison, or directlyfrom an immediate value.
  • For the floating-point compare instructions, FCMP and FCMPE,C and the other condition flags are set to the result of the comparison.
  • For other instructions, C is normally left unchanged,but see the individual instruction descriptions for any specialcases.

Related concepts

Was this page helpful? Yes No