usat16
Unsigned Saturate 16 (A32)
USAT16<c> <Rd>, #<imm>, <Rm>
Saturates two unsigned 16-bit values.
Pseudocode Operation
lower_hw ← Rm[15:0] (unsigned)
upper_hw ← Rm[31:16] (unsigned)
sat_max ← 2^imm - 1
if lower_hw > sat_max then
Rd[15:0] ← sat_max
Q ← 1
else
Rd[15:0] ← lower_hw
if upper_hw > sat_max then
Rd[31:16] ← sat_max
Q ← 1
else
Rd[31:16] ← upper_hw
Example
USAT16 r0, #16, r2
Encoding
Binary Layout
cond
31:28
01101
27:23
1
22
10
21:20
sat_imm
19:16
Rd
15:12
1
11
1
10
1
9
1
8
0011
7:4
Rn
3:0
Operands
-
Rd
Destination general-purpose register -
imm
Bit Position -
Rm
Second source / offset general-purpose register
Related
More in A32 (DSP)
Reference
View in Arm A64 ISA Reference ↗
Arm AArch32 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x06E00F30 | USAT16{<c>}{<q>} <Rd>, #<imm>, <Rn> | A32 | cond | 01101 | 1 | 10 | sat_imm | Rd | 1 | 1 | 1 | 1 | 0011 | Rn | ||
| 0xF3A00000 | USAT16{<c>}{<q>} <Rd>, #<imm>, <Rn> | T32 | 11110 | 0 | 11 | 10 | 1 | 0 | Rn | 0 | 000 | Rd | 00 | 0 | 0 | sat_imm |
Description
Unsigned Saturate 16 saturates two signed 16-bit values to a selected unsigned range. This instruction sets PSTATE.Q to 1 if the operation saturates.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
(result1, sat1) = UnsignedSatQ(SInt(R[n]<15:0>), saturate_to);
(result2, sat2) = UnsignedSatQ(SInt(R[n]<31:16>), saturate_to);
R[d]<15:0> = ZeroExtend(result1, 16);
R[d]<31:16> = ZeroExtend(result2, 16);
if sat1 || sat2 then
PSTATE.Q = '1';