155
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
Examples
QASX
R7, R4, R2
; Adds top halfword of R4 to bottom halfword of R2,
; saturates to 16 bits, writes to top halfword of R7
; Subtracts top highword of R2 from bottom halfword of
; R4, saturates to 16 bits and writes to bottom halfword
; of R7
QSAX
R0, R3, R5
; Subtracts bottom halfword of R5 from top halfword of
; R3, saturates to 16 bits, writes to top halfword of R0
; Adds bottom halfword of R3 to top halfword of R5,
; saturates to 16 bits, writes to bottom halfword of R0.
11.6.7.5
QDADD and QDSUB
Saturating Double and Add and Saturating Double and Subtract, signed.
Syntax
op{cond} {Rd}, Rm, Rn
where:
Operation
The
QDADD
instruction:
• Doubles the second operand value.
• Adds the result of the doubling to the signed saturated value in the first operand.
• Writes the result to the destination register.
The
QDSUB
instruction:
• Doubles the second operand value.
• Subtracts the doubled value from the signed saturated value in the first operand.
• Writes the result to the destination register.
Both the doubling and the addition or subtraction have their results saturated to the 32-bit signed
integer range –2
31
≤
x
≤
2
31
– 1. If saturation occurs in either operation, it sets the Q flag in the
APSR.
Restrictions
Do not use SP and do not use PC
.
Condition Flags
If saturation occurs, these instructions set the Q flag to 1.
op
is one of:
QDADD
Saturating Double and Add.
QDSUB
Saturating Double and Subtract.
cond
is an optional condition code, see
Rd
is the destination register.
Rm, Rn
are registers holding the first and second operands.
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...