10.7 Saturating instructions

Some ARM and Thumb instructions perform saturating arithmetic.

The saturating instructions are:
  • QADD.
  • QDADD.
  • QDSUB.
  • QSUB.
  • SSAT.
  • USAT.
Some of the parallel instructions are also saturating.

Saturating arithmetic

Saturation means that, for some value of 2n that depends on the instruction:
  • For a signed saturating operation, if the full result would be less than -2n, the result returned is -2n.
  • For an unsigned saturating operation, if the full result would be negative, the result returned is zero.
  • If the full result would be greater than 2n-1, the result returned is 2n-1.
When any of these occurs, it is called saturation. Some instructions set the Q flag when saturation occurs.

Note

Saturating instructions do not clear the Q flag when saturation does not occur. To clear the Q flag, use an MSR instruction.
The Q flag can also be set by two other instructions, but these instructions do not saturate.
Related reference
10.74 QADD
10.81 QSUB
10.78 QDADD
10.79 QDSUB
10.109 SMLAxy
10.114 SMLAWy
10.121 SMULxy
10.123 SMULWy
10.126 SSAT
10.174 USAT
10.63 MSR (general-purpose register to PSR)
Non-ConfidentialPDF file icon PDF versionARM DUI0379G
Copyright © 2007, 2008, 2011, 2012, 2014, 2015 ARM. All rights reserved.