uqadd16
Unsigned Saturating Add 16
UQADD16<c> <Rd>, <Rn>, <Rm>
Unsigned saturating add of 2 halfwords.
Details
Performs unsigned saturating addition of two 16-bit halfwords in parallel. Each halfword of Rn is added to the corresponding halfword of Rm; if the result exceeds the unsigned 16-bit range (0–65535), it saturates to 65535. No condition flags are affected; saturation status is not recorded.
Pseudocode Operation
half1_rn ← Rn[15:0]; half2_rn ← Rn[31:16]
half1_rm ← Rm[15:0]; half2_rm ← Rm[31:16]
sum1 ← half1_rn + half1_rm; sum2 ← half2_rn + half2_rm
Rd[15:0] ← (sum1 > 0xFFFF) ? 0xFFFF : sum1
Rd[31:16] ← (sum2 > 0xFFFF) ? 0xFFFF : sum2
Example
UQADD16 r0, r1, r2
Encoding
Binary Layout
cond
01100
110
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 | ||
|---|---|---|---|---|---|
| 0x06600F10 | UQADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | A32 | cond | 01100 | 110 | Rn | Rd | 1 | 1 | 1 | 1 | 0 | 00 | 1 | Rm | ||
| 0xFA90F050 | UQADD16{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | T32 | 111110101 | 001 | Rn | 1111 | Rd | 0 | 1 | 0 | 1 | Rm |
Description
Unsigned Saturating Add 16 performs two unsigned 16-bit integer additions, saturates the results to the 16-bit unsigned integer range 0 <= x <= 216 - 1, and writes the results to the destination register.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
sum1 = UInt(R[n]<15:0>) + UInt(R[m]<15:0>);
sum2 = UInt(R[n]<31:16>) + UInt(R[m]<31:16>);
R[d]<15:0> = UnsignedSat(sum1, 16);
R[d]<31:16> = UnsignedSat(sum2, 16);