sqshrunt

SQSHRUNT <Zd>.<T>, <Zn>.<Tb>, #<const>

Signed Saturating Shift Right Unsigned Narrow (Top)

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
010001010
31:23
tszh
22
1
21
tszl
20:19
imm3
18:16
00
15:14
0
13
0
12
0
11
1
10
Zn
9:5
Zd
4:0
 
Format SVE2
Opcode 0x45200400
Extension SVE2

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x45200400 SQSHRUNT <Zd>.<T>, <Zn>.<Tb>, #<const> A64 010001010 | tszh | 1 | tszl | imm3 | 00 | 0 | 0 | 0 | 1 | Zn | Zd

Description

Shift each signed integer value in the source vector elements right by an immediate value, and place the truncated results in the odd-numbered half-width destination elements, leaving the even-numbered elements unchanged. Each result element is saturated to the half-width N-bit element's unsigned integer range 0 to (2N)-1. The immediate shift amount is an unsigned value in the range 1 to number of bits per element. This instruction is unpredicated.

Operation

CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV (2 * esize);
bits(VL) operand = Z[n, VL];
bits(VL) result = Z[d, VL];

for e = 0 to elements-1
    bits(2*esize) element = Elem[operand, e, 2*esize];
    integer res = SInt(element) >> shift;
    Elem[result, 2*e + 1, esize] = UnsignedSat(res, esize);

Z[d, VL] = result;