uqsub

UQSUB <Zd>.<T>, <Zn>.<T>, <Zm>.<T>

Unsigned Saturating Subtract.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
00000100
31:24
size
23:22
1
21
Zm
20:16
000
15:13
11
12:11
1
10
Zn
9:5
Zd
4:0
 
Format SVE2
Opcode 0x04201C00
Extension SVE2

Related

Other forms of uqsub

  • uqsub Vector Unsigned Saturating Subtract

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x7E202C00 UQSUB <V><d>, <V><n>, <V><m> A64 01 | 1 | 11110 | size | 1 | Rm | 00101 | 1 | Rn | Rd
0x2E202C00 UQSUB <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 1 | 01110 | size | 1 | Rm | 00101 | 1 | Rn | Rd
0x441B8000 UQSUB <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T> A64 01000100 | size | 011 | 0 | 1 | 1 | 100 | Pg | Zm | Zdn
0x2527C000 UQSUB <Zdn>.<T>, <Zdn>.<T>, #<imm>{, <shift>} A64 00100101 | size | 100 | 11 | 1 | 11 | sh | imm8 | Zdn
0x04201C00 UQSUB <Zd>.<T>, <Zn>.<T>, <Zm>.<T> A64 00000100 | size | 1 | Zm | 000 | 11 | 1 | Zn | Zd

Description

Unsigned saturating subtract all elements of the second source vector from corresponding elements of the first source vector and place the results in the corresponding elements of the destination vector. Each result element is saturated to the N-bit element's unsigned integer range 0 to (2N)-1. This instruction is unpredicated.

Operation

CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer elements = VL DIV esize;
bits(VL) operand1 = Z[n, VL];
bits(VL) operand2 = Z[m, VL];
bits(VL) result;

for e = 0 to elements-1
    integer element1 = Int(Elem[operand1, e, esize], unsigned);
    integer element2 = Int(Elem[operand2, e, esize], unsigned);
    (Elem[result, e, esize], -) = SatQ(element1 - element2, esize, unsigned);

Z[d, VL] = result;