sqrdmulh

SVE Signed Saturating Rounding Doubling Multiply High

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

Multiplies, doubles, rounds, and returns high half (Fixed point math).

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
00000100
31:24
size
23:22
1
21
Zm
20:16
01110
15:11
1
10
Zn
9:5
Zd
4:0
 
Format SVE2 Integer Binary
Opcode 0x04207400
Extension SVE2

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x5F00D000 SQRDMULH <V><d>, <V><n>, <Vm>.<Ts>[<index>] A64 01 | 0 | 11111 | size | L | M | Rm | 110 | 1 | H | 0 | Rn | Rd
0x0F00D000 SQRDMULH <Vd>.<T>, <Vn>.<T>, <Vm>.<Ts>[<index>] A64 0 | Q | 0 | 01111 | size | L | M | Rm | 110 | 1 | H | 0 | Rn | Rd
0x7E20B400 SQRDMULH <V><d>, <V><n>, <V><m> A64 01 | 1 | 11110 | size | 1 | Rm | 10110 | 1 | Rn | Rd
0x2E20B400 SQRDMULH <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 1 | 01110 | size | 1 | Rm | 10110 | 1 | Rn | Rd
0x04207400 SQRDMULH <Zd>.<T>, <Zn>.<T>, <Zm>.<T> A64 00000100 | size | 1 | Zm | 01110 | 1 | Zn | Zd
0x4420F400 SQRDMULH <Zd>.H, <Zn>.H, <Zm>.H[<imm>] A64 01000100 | 0 | i3h | 1 | i3l | Zm | 11110 | 1 | Zn | Zd
0x44A0F400 SQRDMULH <Zd>.S, <Zn>.S, <Zm>.S[<imm>] A64 01000100 | 1 | 0 | 1 | i2 | Zm | 11110 | 1 | Zn | Zd
0x44E0F400 SQRDMULH <Zd>.D, <Zn>.D, <Zm>.D[<imm>] A64 01000100 | 1 | 1 | 1 | i1 | Zm | 11110 | 1 | Zn | Zd

Description

Multiply then double the corresponding signed elements of the first and second source vectors, and place the most significant rounded half of the result 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 = SInt(Elem[operand1, e, esize]);
    integer element2 = SInt(Elem[operand2, e, esize]);
    integer res = 2 * element1 * element2;
    Elem[result, e, esize] = SignedSat((res + (1 << (esize - 1))) >> esize, esize);

Z[d, VL] = result;