-1

Q flag also known as saturation flag sets when the results causes an overflow or saturation. Similarly, the overflow flag also sets when the results causes an overflow. What is the major difference between these two flags ?

artless noise
  • 21,212
  • 6
  • 68
  • 105

1 Answers1

1

The Q flag is "sticky" it is not cleared my subsequent operations. It can there fore be used to determine whether saturation or overflow occurred at any point since it was last explicitly cleared.

The C (overflow or carry/borrow) flag is set or cleared as the result of a single arithmetic instruction, so must be tested immediately after the instruction that might set it. The C flag can be tested in conditional instructions and can be used to extend arithmetic allowing for example 64bit operations from 32 bit instructions.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • 1
    An additional benefit is that only some operation affect the 'Q' flag. Ie, the instructions which set the 'Q` flag are a subset of those setting the 'C' flag. – artless noise Dec 10 '20 at 13:05