cdot

Complex Dot Product (SVE2)

CDOT <Zda>.<T>, <Zn>.<Tb>, <Zm>.<Tb>, <const>

Computes complex integer dot product.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
01000100
31:24
size
23:22
0
21
Zm
20:16
0001
15:12
rot
11:10
Zn
9:5
Zda
4:0
 
Format SVE2 Complex
Opcode 0x44001000
Extension SVE2

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x44001000 CDOT <Zda>.<T>, <Zn>.<Tb>, <Zm>.<Tb>, <const> A64 01000100 | size | 0 | Zm | 0001 | rot | Zn | Zda
0x44A04000 CDOT <Zda>.S, <Zn>.B, <Zm>.B[<imm>], <const> A64 01000100 | 1 | 0 | 1 | i2 | Zm | 0100 | rot | Zn | Zda
0x44E04000 CDOT <Zda>.D, <Zn>.H, <Zm>.H[<imm>], <const> A64 01000100 | 1 | 1 | 1 | i1 | Zm | 0100 | rot | Zn | Zda

Description

The complex integer dot product instructions delimit the source vectors into pairs of 8-bit or 16-bit signed integer complex numbers. Within each pair, the complex numbers in the first source vector are multiplied by the corresponding complex numbers in the second source vector and the resulting wide real or wide imaginary part of the product is accumulated into a 32-bit or 64-bit destination vector element which overlaps all four of the elements that comprise a pair of complex number values in the first source vector. As a result each instruction implicitly deinterleaves the real and imaginary components of their complex number inputs, so that the destination vector accumulates 4×wide real sums or 4×wide imaginary sums. The complex numbers in the second source vector are rotated by 0, 90, 180 or 270 degrees in the direction from the positive real axis towards the positive imaginary axis, when considered in polar representation, by performing the following transformations prior to the dot product operations: Each complex number is represented in a vector register as an even/odd pair of elements with the real part in the even-numbered element and the imaginary part in the odd-numbered element.

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) operand3 = Z[da, VL];
bits(VL) result;

for e = 0 to elements-1
    bits(esize) res = Elem[operand3, e, esize];
    for i = 0 to 1
        integer elt1_r = SInt(Elem[operand1, 4 * e + 2 * i + 0, esize DIV 4]);
        integer elt1_i = SInt(Elem[operand1, 4 * e + 2 * i + 1, esize DIV 4]);
        integer elt2_a = SInt(Elem[operand2, 4 * e + 2 * i + sel_a, esize DIV 4]);
        integer elt2_b = SInt(Elem[operand2, 4 * e + 2 * i + sel_b, esize DIV 4]);
        if sub_i then
            res = (res + (elt1_r * elt2_a)) - (elt1_i * elt2_b);
        else
            res = res + (elt1_r * elt2_a) + (elt1_i * elt2_b);
    Elem[result, e, esize] = res;

Z[da, VL] = result;