mls

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

Integer Multiply-Subtract.

Pseudocode Operation

No pseudocode available.

Encoding

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

Related

Other forms of mls

  • mls Vector Multiply-Subtract
  • mls Multiply Subtract (Thumb)
  • mls Multiply Subtract (A32)

More in SVE

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x2F004000 MLS <Vd>.<T>, <Vn>.<T>, <Vm>.<Ts>[<index>] A64 0 | Q | 1 | 01111 | size | L | M | Rm | 0 | 1 | 00 | H | 0 | Rn | Rd
0x2E209400 MLS <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 1 | 01110 | size | 1 | Rm | 10010 | 1 | Rn | Rd
0x04006000 MLS <Zda>.<T>, <Pg>/M, <Zn>.<T>, <Zm>.<T> A64 00000100 | size | 0 | Zm | 01 | 1 | Pg | Zn | Zda
0x44200C00 MLS <Zda>.H, <Zn>.H, <Zm>.H[<imm>] A64 01000100 | 0 | i3h | 1 | i3l | Zm | 00001 | 1 | Zn | Zda
0x44A00C00 MLS <Zda>.S, <Zn>.S, <Zm>.S[<imm>] A64 01000100 | 1 | 0 | 1 | i2 | Zm | 00001 | 1 | Zn | Zda
0x44E00C00 MLS <Zda>.D, <Zn>.D, <Zm>.D[<imm>] A64 01000100 | 1 | 1 | 1 | i1 | Zm | 00001 | 1 | Zn | Zda

Description

Multiply the corresponding active elements of the first and second source vectors and subtract from 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;