mla

MLA <Zda>.<T>, <Pg>/M, <Zn>.<T>, <Zm>.<T>

Integer Multiply-Add.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
00000100
31:24
size
23:22
0
21
Zm
20:16
01
15:14
0
13
Pg
12:10
Zn
9:5
Zda
4:0
 
Format SVE
Opcode 0x04004000
Extension SVE

Related

Other forms of mla

  • mla Vector Multiply-Accumulate
  • mla Multiply Accumulate (Thumb)
  • mla Multiply Accumulate (A32)

More in SVE

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x2F000000 MLA <Vd>.<T>, <Vn>.<T>, <Vm>.<Ts>[<index>] A64 0 | Q | 1 | 01111 | size | L | M | Rm | 0 | 0 | 00 | H | 0 | Rn | Rd
0x0E209400 MLA <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 0 | 01110 | size | 1 | Rm | 10010 | 1 | Rn | Rd
0x04004000 MLA <Zda>.<T>, <Pg>/M, <Zn>.<T>, <Zm>.<T> A64 00000100 | size | 0 | Zm | 01 | 0 | Pg | Zn | Zda
0x44200800 MLA <Zda>.H, <Zn>.H, <Zm>.H[<imm>] A64 01000100 | 0 | i3h | 1 | i3l | Zm | 00001 | 0 | Zn | Zda
0x44A00800 MLA <Zda>.S, <Zn>.S, <Zm>.S[<imm>] A64 01000100 | 1 | 0 | 1 | i2 | Zm | 00001 | 0 | Zn | Zda
0x44E00800 MLA <Zda>.D, <Zn>.D, <Zm>.D[<imm>] A64 01000100 | 1 | 1 | 1 | i1 | Zm | 00001 | 0 | Zn | Zda

Description

Multiply the corresponding active elements of the first and second source vectors and add to elements of the third source (addend) vector. Destructively place the results in the destination and third source (addend) vector. 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 = if AnyActiveElement(mask, esize) then Z[n, VL] else Zeros(VL);
bits(VL) operand2 = if AnyActiveElement(mask, esize) then Z[m, VL] else Zeros(VL);
bits(VL) operand3 = Z[da, VL];
bits(VL) result;

for e = 0 to elements-1
    if ActivePredicateElement(mask, e, esize) then
        integer element1 = UInt(Elem[operand1, e, esize]);
        integer element2 = UInt(Elem[operand2, e, esize]);
        integer product = element1 * element2;
        if sub_op then
            Elem[result, e, esize] = Elem[operand3, e, esize] - product;
        else
            Elem[result, e, esize] = Elem[operand3, e, esize] + product;
    else
        Elem[result, e, esize] = Elem[operand3, e, esize];

Z[da, VL] = result;