3.9 TheQ flag in AArch32 state
The Q flag indicates overflow or saturation. It is one of the program status flags held in the APSR.
The Q flag is set to 1 when saturation occurs in saturatingarithmetic instructions, or when overflow occurs in certain multiplyinstructions.
The Q flag is a sticky flag. Althoughthe saturating and certain multiply instructions can set the flag,they cannot clear it. You can execute a series of such instructions,and then test the flag to find out whether saturation or overflowoccurred at any point in the series, without having to check theflag after each instruction.
To clear the Q flag, use an
MSR instructionto read-modify-write the APSR:
MRS r5, APSR BIC r5, r5, #(1<<27) MSR APSR_nzcvq, r5
The state of the Q flag cannot be tested directly by the conditioncodes. To read the state of the Q flag, use an
MRS r6, APSR TST r6, #(1<<27); Z is clear if Q flag was set