4.5.2. QADD, QSUB, QDADD, and QDSUB

Signed Add, Subtract, Double and Add, Double and Subtract, saturating the result to the signed range -231x ≤ 231-1.

See also Parallel add and subtract.

Syntax

op{cond} {Rd}, Rm, Rn

where:

op

is one of QADD, QSUB, QDADD, or QDSUB.

cond

is an optional condition code (see Conditional execution).

Rd

is the destination register.

Rm, Rn

are the registers holding the operands.

Do not use r15 for Rd, Rm, or Rn.

Usage

The QADD instruction adds the values in Rm and Rn.

The QSUB instruction subtracts the value in Rn from the value in Rm.

The QDADD instruction calculates SAT(Rm + SAT(Rn * 2)). Saturation can occur on the doubling operation, on the addition, or on both. If saturation occurs on the doubling but not on the addition, the Q flag is set but the final result is unsaturated.

The QDSUB instruction calculates SAT(Rm - SAT(Rn * 2)). Saturation can occur on the doubling operation, on the subtraction, or on both. If saturation occurs on the doubling but not on the subtraction, the Q flag is set but the final result is unsaturated.

Note

All values are treated as two’s complement signed integers by these instructions.

See also Parallel add and subtract for similar parallel instructions, available in ARMv6 and above only.

Condition flags

If saturation occurs, these instructions set the Q flag. To read the state of the Q flag, use an MRS instruction (see MRS).

Architectures

These ARM instructions are available in ARMv6 and above, and E variants of ARMv5T.

These 32-bit Thumb instructions are available in ARMv6T2 and above, except the ARMv7-M profile.

There are no 16-bit Thumb versions of these instructions.

Examples

    QADD    r0, r1, r9
    QDSUBLT r9, r0, r1
Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0204J
Non-ConfidentialID101213