sqsub

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

Signed 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
0
10
Zn
9:5
Zd
4:0
 
Format SVE2
Opcode 0x04201800
Extension SVE2

Related

Other forms of sqsub

  • sqsub Vector Signed Saturating Subtract

More in SVE2

Reference

Instruction Forms

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

Description

Signed 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 signed integer range -2(N-1) to (2(N-1) )-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;