qdadd

Saturating Double and Add

QDADD<c> <Rd>, <Rm>, <Rn>

Doubles the second operand, adds to first, and saturates.

Pseudocode Operation

doubled ← SignedSat(Rm << 1, 32)
result ← SignedSat(Rn + doubled, 32)
Rd ← result
if (overflow during doubling or addition) then Q ← 1

Example

QDADD r0, r2, r1

Encoding

Binary Layout
cond
31:28
00010
27:23
10
22:21
0
20
Rn
19:16
Rd
15:12
0
11
0
10
0
9
0
8
0101
7:4
Rm
3:0
 
Format Data Proc
Opcode 0x01400050
Extension A32 (Sat)

Operands

  • Rd
    Destination general-purpose register
  • Rm
    Second source / offset general-purpose register
  • Rn
    First source / base general-purpose register

Related

More in A32 (Sat)

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x01400050 QDADD{<c>}{<q>} {<Rd>,} <Rm>, <Rn> A32 cond | 00010 | 10 | 0 | Rn | Rd | 0 | 0 | 0 | 0 | 0101 | Rm
0xFA80F090 QDADD{<c>}{<q>} {<Rd>,} <Rm>, <Rn> T32 111110101 | 000 | Rn | 1111 | Rd | 10 | 01 | Rm

Description

Saturating Double and Add adds a doubled register value to another register value, and writes the result to the destination register. Both the doubling and the addition have their results saturated to the 32-bit signed integer range -231 <= x <= 231 - 1. If saturation occurs in either operation, it sets PSTATE.Q to 1.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();
    (doubled, sat1) = SignedSatQ(2 * SInt(R[n]), 32);
    boolean sat2;
    (R[d], sat2)  = SignedSatQ(SInt(R[m]) + SInt(doubled), 32);
    if sat1 || sat2 then
        PSTATE.Q = '1';