sadd16
Signed Add 16 (A32)
SADD16<c> <Rd>, <Rn>, <Rm>
Parallel add of two signed 16-bit halfwords.
Details
Performs two independent parallel signed 16-bit additions: the high halfword of Rn is added to the high halfword of Rm, and the low halfword of Rn is added to the low halfword of Rm; results are stored in the corresponding halfwords of Rd. The CPSR GE[3:0] flags are updated to reflect signed overflow in each halfword; N, Z, C, V are unaffected. A32 only; requires DSP extension; executes in User and Privileged modes.
Pseudocode Operation
Rd[31:16] ← Rn[31:16] + Rm[31:16]
Rd[15:0] ← Rn[15:0] + Rm[15:0]
GE[3] ← (Rd[31:16] >= 0) ? 1 : 0
GE[2] ← (Rd[31:16] < 0) ? 0 : 1
GE[1] ← (Rd[15:0] >= 0) ? 1 : 0
GE[0] ← (Rd[15:0] < 0) ? 0 : 1
Example
SADD16 r0, r1, r2
Encoding
Binary Layout
cond
01100
001
Rn
Rd
1
1
1
1
0
00
1
Rm
Operands
-
Rd
Destination general-purpose register -
Rn
First source / base general-purpose register -
Rm
Second source / offset general-purpose register
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x06100F10 | SADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | A32 | cond | 01100 | 001 | Rn | Rd | 1 | 1 | 1 | 1 | 0 | 00 | 1 | Rm | ||
| 0xFA90F000 | SADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | T32 | 111110101 | 001 | Rn | 1111 | Rd | 0 | 0 | 0 | 0 | Rm |
Description
Signed Add 16 performs two 16-bit signed integer additions, and writes the results to the destination register. It sets PSTATE.GE according to the results of the additions.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = SInt(R[n]<15:0>) + SInt(R[m]<15:0>);
sum2 = SInt(R[n]<31:16>) + SInt(R[m]<31:16>);
R[d]<15:0> = sum1<15:0>;
R[d]<31:16> = sum2<15:0>;
PSTATE.GE<1:0> = if sum1 >= 0 then '11' else '00';
PSTATE.GE<3:2> = if sum2 >= 0 then '11' else '00';