I32MAD2

Integer and 8-bit color instructions

fixed bit field field the encoding fixes should be

Encoding

6362616059585756555453525150494847464544434241403938373635343332
11010prednoschedsndest_extendsrc1_extsrc2_extsrc0_extcount00is_signedneg1neg20000src0_bankdest_bank
313029282726252423222120191817161514131211109876543210
src1_banksrc2_bankdest_nsrc0_nsrc1_nsrc2_n

bits 63:0: 1101 0xxx -xxx xxxx xxxx 00xx x000 0xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

Runs execute_I32MAD2 with Form() 0.

Fields

FieldBitsThe Sail reads it in
pred58:56
nosched54
sn53:52execute_I32MAD2
dest_ext51Bit(51)
end50
src1_ext49Bit(49)
src2_ext48Bit(48)
src0_ext47Bit(47)
count46:44execute_I32MAD2
is_signed41Bit(41)
neg140Bit(40)
neg239Bit(39)
src0_bank34Bit(34)
dest_bank33:32execute_I32MAD2
src1_bank31:30execute_I32MAD2
src2_bank29:28execute_I32MAD2
dest_n27:21execute_I32MAD2
src0_n20:14execute_I32MAD2
src1_n13:7execute_I32MAD2
src2_n6:0execute_I32MAD2

Operation Sail

I32MAD2: src0 * src1 + src2 of 32-bit integers, src1 and src2 negated where they say; sn passes src2 through (Vita3K's hardware tests). A repeat at a time

Dest(DEST, UInt(Field(21, 7)), UInt(Field(32, 2)), Bit(51), 0, 7);
Src0(SRC0, UInt(Field(14, 7)), Bit(34), Bit(47), 0, 7);
Src12(SRC1, UInt(Field(7, 7)), UInt(Field(30, 2)), Bit(49), 0, 7);
Src12(SRC2, UInt(Field(0, 7)), UInt(Field(28, 2)), Bit(48), 0, 7);
let type = if Bit(41) == 1 then T_I32 else T_U32;
SetType(DEST, type);
SetType(SRC0, type);
SetType(SRC1, type);
SetType(SRC2, type);
if Bit(40) == 1 then AddFlags(SRC1, F_NEG);
if Bit(39) == 1 then AddFlags(SRC2, F_NEG);
Multiplier(1, 1, 1, 1);
foreach (r from 0 to UInt(Field(44, 3))) {
    if not_bool(Failed()) then {
        Load(A, SRC0, 1, Rep(SRC0, r, O_SRC0, R_SLMSI));
        Load(B, SRC1, 1, Rep(SRC1, r, O_SRC1, R_SLMSI));
        Load(C, SRC2, 1, Rep(SRC2, r, O_SRC2, R_SLMSI));
        if not_bool(Failed()) then {
            if UInt(Field(52, 2)) != 0 then Store(DEST, C, 1, Rep(DEST, r, O_DEST, R_SLMSI))
            else {
                Imad();
                Store(DEST, R, 1, Rep(DEST, r, O_DEST, R_SLMSI))
            }
        }
    }
};
ResetMultiplier()

Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Vita3K's usse_translator_entry.cpp (GPL-2.0-or-later).