cmla

SVE Complex Integer Multiply-Accumulate

CMLA <Zda>.<T>, <Zn>.<T>, <Zm>.<T>, <const>

Performs complex integer multiply-accumulate with rotation.

Pseudocode Operation

No pseudocode available.

Encoding

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

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x44002000 CMLA <Zda>.<T>, <Zn>.<T>, <Zm>.<T>, <const> A64 01000100 | size | 0 | Zm | 001 | 0 | rot | Zn | Zda
0x44A06000 CMLA <Zda>.H, <Zn>.H, <Zm>.H[<imm>], <const> A64 01000100 | 1 | 0 | 1 | i2 | Zm | 0110 | rot | Zn | Zda
0x44E06000 CMLA <Zda>.S, <Zn>.S, <Zm>.S[<imm>], <const> A64 01000100 | 1 | 1 | 1 | i1 | Zm | 0110 | rot | Zn | Zda

Description

Multiply the duplicated real components for rotations 0 and 180, or imaginary components for rotations 90 and 270, of the integral numbers in the first source vector by the corresponding complex number in the second source vector 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. Then add the products to the corresponding components of the complex numbers in the addend vector. Destructively place the results in the corresponding elements of the addend vector. This instruction is unpredicated. These transformations permit the creation of a variety of multiply-add and multiply-subtract operations on complex numbers by combining two of these instructions with the same vector operands but with rotations that are 90 degrees apart. 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 PL = VL DIV 8;
constant integer pairs = VL DIV (2 * esize);
bits(VL) operand1 = Z[n, VL];
bits(VL) operand2 = Z[m, VL];
bits(VL) operand3 = Z[da, VL];
bits(VL) result;

for p = 0 to pairs-1
    integer elt1_a = SInt(Elem[operand1, 2 * p + sel_a, esize]);
    integer elt2_a = SInt(Elem[operand2, 2 * p + sel_a, esize]);
    integer elt2_b = SInt(Elem[operand2, 2 * p + sel_b, esize]);
    bits(esize) elt3_r = Elem[operand3, 2 * p + 0, esize];
    bits(esize) elt3_i = Elem[operand3, 2 * p + 1, esize];
    integer product_r =  elt1_a * elt2_a;
    integer product_i =  elt1_a * elt2_b;
    if sub_r then
        Elem[result, 2 * p + 0, esize] = elt3_r - product_r;
    else
        Elem[result, 2 * p + 0, esize] = elt3_r + product_r;
    if sub_i then
        Elem[result, 2 * p + 1, esize] = elt3_i - product_i;
    else
        Elem[result, 2 * p + 1, esize] = elt3_i + product_i;

Z[da, VL] = result;