sqrshl

Signed Saturating Rounding Shift Left (SVE2)

SQRSHL <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T>

Saturating, rounding left shift by vector.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
01000100
31:24
size
23:22
00
21:20
1
19
0
18
1
17
0
16
100
15:13
Pg
12:10
Zm
9:5
Zdn
4:0
 
Format SVE2 Shift
Opcode 0x440A8000
Extension SVE2

Operands

  • Zdn
    Dest/Src
  • Zm
    Shift

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x5E205C00 SQRSHL <V><d>, <V><n>, <V><m> A64 01 | 0 | 11110 | size | 1 | Rm | 010 | 1 | 1 | 1 | Rn | Rd
0x0E205C00 SQRSHL <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 0 | 01110 | size | 1 | Rm | 010 | 1 | 1 | 1 | Rn | Rd
0x440A8000 SQRSHL <Zdn>.<T>, <Pg>/M, <Zdn>.<T>, <Zm>.<T> A64 01000100 | size | 00 | 1 | 0 | 1 | 0 | 100 | Pg | Zm | Zdn

Description

Shift active signed elements of the first source vector by corresponding elements of the second source vector and destructively place the rounded results in the corresponding elements of the first source vector. A positive shift amount performs a left shift, otherwise a right shift by the negated shift amount is performed. Each result element is saturated to the N-bit element's signed integer range -2(N-1) to (2(N-1) )-1. Inactive elements in the destination vector register remain unmodified.

Operation

CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(PL) mask = P[g, PL];
bits(VL) operand1 = Z[dn, VL];
bits(VL) operand2 = if AnyActiveElement(mask, esize) then Z[m, VL] else Zeros(VL);
bits(VL) result;

for e = 0 to elements-1
    if ActivePredicateElement(mask, e, esize) then
        integer element = SInt(Elem[operand1, e, esize]);
        integer shift = ShiftSat(SInt(Elem[operand2, e, esize]), esize);
        integer res;
        if shift >= 0 then
            res = element << shift;
        else
            shift = -shift;
            res = (element + (1 << (shift - 1))) >> shift;
        Elem[result, e, esize] = SignedSat(res, esize);
    else
        Elem[result, e, esize] = Elem[operand1, e, esize];

Z[dn, VL] = result;