EasyManua.ls Logo

ARM Cortex-M4 - Saturating Instructions

ARM Cortex-M4
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The Cortex-M4 Instruction Set
ARM DUI 0553A Copyright © 2010 ARM. All rights reserved. 3-95
ID121610 Non-Confidential
3.7 Saturating instructions
Table 3-10 shows the saturating instructions:
For signed n-bit saturation, this means that:
if the value to be saturated is less than 2
n1
, the result returned is 2
n-1
if the value to be saturated is greater than 2
n1
1, the result returned is 2
n-1
1
otherwise, 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
1
otherwise, 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 on page 3-164.
To read the state of the Q flag, use the
MRS
instruction, see MRS on page 3-163.
Table 3-10 Saturating instructions
Mnemonic Brief description See
SSAT
Signed Saturate SSAT and USAT on page 3-96
SSAT16
Signed Saturate Halfword SSAT16 and USAT16 on page 3-97
USAT
Unsigned Saturate SSAT and USAT on page 3-96
USAT16
Unsigned Saturate Halfword SSAT16 and USAT16 on page 3-97
QADD
Saturating Add QADD and QSUB on page 3-98
QSUB
Saturating Subtract QADD and QSUB on page 3-98
QSUB16
Saturating Subtract 16 QADD and QSUB on page 3-98
QASX
Saturating Add and Subtract with Exchange QASX and QSAX on page 3-100
QSAX
Saturating Subtract and Add with Exchange QASX and QSAX on page 3-100
QDADD
Saturating Double and Add QDADD and QDSUB on page 3-102
QDSUB
Saturating Double and Subtract QDADD and QDSUB on page 3-102
UQADD16
Unsigned Saturating Add 16 UQADD and UQSUB on page 3-105
UQADD8
Unsigned Saturating Add 8 UQADD and UQSUB on page 3-105
UQASX
Unsigned Saturating Add and Subtract with Exchange UQASX and UQSAX on page 3-103
UQSAX
Unsigned Saturating Subtract and Add with Exchange UQASX and UQSAX on page 3-103
UQSUB16
Unsigned Saturating Subtract 16 UQADD and UQSUB on page 3-105
UQSUB8
Unsigned Saturating Subtract 8 UQADD and UQSUB on page 3-105

Table of Contents

Related product manuals