| |||

Home > The Cortex-M7 Instruction Set > Saturating instructions |

Table 3.10 shows the saturating instructions:

**Table 3.10. Saturating instructions**

Mnemonic | Brief description | See |
---|---|---|

`SSAT` | Signed Saturate | SSAT and USAT |

`SSAT16` | Signed Saturate Halfword | SSAT16 and USAT16 |

`USAT` | Unsigned Saturate | SSAT and USAT |

`USAT16` | Unsigned Saturate Halfword | SSAT16 and USAT16 |

`QADD` | Saturating Add | QADD and QSUB |

`QSUB` | Saturating Subtract | QADD and QSUB |

`QSUB16` | Saturating Subtract 16 | QADD and QSUB |

`QASX` | Saturating Add and Subtract with Exchange | QASX and QSAX |

`QSAX` | Saturating Subtract and Add with Exchange | QASX and QSAX |

`QDADD` | Saturating Double and Add | QDADD and QDSUB |

`QDSUB` | Saturating Double and Subtract | QDADD and QDSUB |

`UQADD16` | Unsigned Saturating Add 16 | UQADD and UQSUB |

`UQADD8` | Unsigned Saturating Add 8 | UQADD and UQSUB |

`UQASX` | Unsigned Saturating Add and Subtract with Exchange | UQASX and UQSAX |

`UQSAX` | Unsigned Saturating Subtract and Add with Exchange | UQASX and UQSAX |

`UQSUB16` | Unsigned Saturating Subtract 16 | UQADD and UQSUB |

`UQSUB8` | Unsigned Saturating Subtract 8 | UQADD and UQSUB |

For signed * n*-bit saturation, this
means that:

If the value to be saturated is less than −2

^{n−1}^{}, the result returned is −2^{n-1}If the value to be saturated is greater than 2

^{n−1}^{}−1, the result returned is 2^{n-1}−1Otherwise, the result returned is the same as the value to be saturated.

For unsigned * n*-bit saturation,
this means that:

If the value to be saturated is less than 0, the result returned is 0

If the value to be saturated is greater than 2

^{n}^{}−1, the result returned is 2^{n}−1Otherwise, the result returned is the same as the value to be saturated.

If the returned result is different from the value to be saturated,
it is called *saturation*. If saturation occurs,
the instruction sets the Q flag to 1 in the APSR. Otherwise, it
leaves the Q flag unchanged. To clear the Q flag to 0, you must
use the `MSR`

instruction, see *MSR*.

To read the state of the Q flag, use the `MRS`

instruction,
see *MRS*.