uqsub8
Unsigned Saturating Subtract 8
UQSUB8<c> <Rd>, <Rn>, <Rm>
Unsigned saturating subtract of 4 bytes.
Details
Performs unsigned saturating subtraction of four 8-bit bytes in parallel. Each byte of Rm is subtracted from the corresponding byte of Rn; if the result would be negative, it saturates to 0. No condition flags are affected; saturation status is not recorded.
Pseudocode Operation
for i = 0 to 3 do
byte_rn ← Rn[8*i+7:8*i]; byte_rm ← Rm[8*i+7:8*i]
diff ← byte_rn - byte_rm
Rd[8*i+7:8*i] ← (diff < 0) ? 0 : diff
Example
UQSUB8 r0, r1, r2
Encoding
Binary Layout
cond
01100
110
Rn
Rd
1
1
1
1
1
11
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 | ||
|---|---|---|---|---|---|
| 0x06600FF0 | UQSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | A32 | cond | 01100 | 110 | Rn | Rd | 1 | 1 | 1 | 1 | 1 | 11 | 1 | Rm | ||
| 0xFAC0F050 | UQSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | T32 | 111110101 | 100 | Rn | 1111 | Rd | 0 | 1 | 0 | 1 | Rm |
Description
Unsigned Saturating Subtract 8 performs four unsigned 8-bit integer subtractions, saturates the results to the 8-bit unsigned integer range 0 <= x <= 28 - 1, and writes the results to the destination register.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
diff1 = UInt(R[n]<7:0>) - UInt(R[m]<7:0>);
diff2 = UInt(R[n]<15:8>) - UInt(R[m]<15:8>);
diff3 = UInt(R[n]<23:16>) - UInt(R[m]<23:16>);
diff4 = UInt(R[n]<31:24>) - UInt(R[m]<31:24>);
R[d]<7:0> = UnsignedSat(diff1, 8);
R[d]<15:8> = UnsignedSat(diff2, 8);
R[d]<23:16> = UnsignedSat(diff3, 8);
R[d]<31:24> = UnsignedSat(diff4, 8);