7.9 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 unsigned overflow), 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, an unsigned underflow), and to 1 otherwise.
  • For non-additions/subtractions that incorporate a shift operation, C is set to the last bit shifted out of the value by the shifter.
  • For other non-additions/subtractions, C is normally left unchanged, but see the individual instruction descriptions for any special cases.
  • The floating-point compare instructions, VCMP and VCMPE set the C flag and the other condition flags in the FPSCR to the result of 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 unsigned overflow), and to 0 otherwise.
  • For a subtraction, including the comparison instruction CMP and the negate instructions NEGS and NGCS, C is set to 0 if the subtraction produced a borrow (that is, an unsigned underflow), and to 1 otherwise.
  • For the integer and floating-point conditional compare instructions CCMP, CCMN, FCCMP, and FCCMPE, C and the other condition flags are set either to the result of the comparison, or directly from 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 special cases.
Non-ConfidentialPDF file icon PDF versionARM 100069_0608_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.