uhsub8
Unsigned Halving Subtract 8
UHSUB8<c> <Rd>, <Rn>, <Rm>
Unsigned halving subtract of 4 bytes.
Details
Performs unsigned halving subtraction of four 8-bit bytes in parallel. Each byte of Rm is subtracted from the corresponding byte of Rn and the result is divided by 2 (rounded down). No condition flags are affected.
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 >> 1
Example
UHSUB8 r0, r1, r2
Encoding
Binary Layout
cond
01100
111
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 | ||
|---|---|---|---|---|---|
| 0x06700FF0 | UHSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | A32 | cond | 01100 | 111 | Rn | Rd | 1 | 1 | 1 | 1 | 1 | 11 | 1 | Rm | ||
| 0xFAC0F060 | UHSUB8{<c>}{<q>} {<Rd>,} <Rn>, <Rm> | T32 | 111110101 | 100 | Rn | 1111 | Rd | 0 | 1 | 1 | 0 | Rm |
Description
Unsigned Halving Subtract 8 performs four unsigned 8-bit integer subtractions, halves the results, 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> = diff1<8:1>;
R[d]<15:8> = diff2<8:1>;
R[d]<23:16> = diff3<8:1>;
R[d]<31:24> = diff4<8:1>;