V32NMAD

Vector float instructions

fixed bit field field the encoding fixes should be

Encoding

6362616059585756555453525150494847464544434241403938373635343332
00001predskipinvsrc1_swiz[11:10]syncstartdest_extsrc1_swiz[9]src1_extsrc2_extsrc2_swiznoschedmasksrc1_modsrc2_modsrc1_swiz[8:7]dest_bank
313029282726252423222120191817161514131211109876543210
src1_banksrc2_bankdest_nsrc1_swiz[6:0]alusrc1_nsrc2_n

bits 63:0: 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

Its format is @nmad.

Runs execute_NMAD with Form() 0.

Fields

Its operation is 2 opcodes' (Form() tells them apart), so it may read the fields of their layouts too.

FieldBitsThe Sail reads it in
pred58:56
skipinv55
src1_swiz54:53, 50, 35:34, 21:15execute_NMAD
syncstart52
dest_ext51Bit(51)
src1_ext49Bit(49)
src2_ext48Bit(48)
src2_swiz47:44execute_NMAD
nosched43
mask42:39execute_NMAD
src1_mod38:37execute_NMAD
src2_mod36Bit(36)
dest_bank33:32execute_NMAD
src1_bank31:30execute_NMAD
src2_bank29:28execute_NMAD
dest_n27:22execute_NMAD
alu14:12execute_NMAD
src1_n11:6execute_NMAD
src2_n5:0execute_NMAD

Operation Sail

V32NMAD and V16NMAD: the ALU operation alu of src1 and src2 (0 multiply, 1 add, 2 FRC: src1 - floor(src2), 3 and 4 the derivatives of src1, 5 min, 6 max), in each component the mask enables; 7 the dot product of all four, in each of them

let type = if Form() == 0 then T_F32 else T_F16;
let alu = UInt(Field(12, 3));
let mask = UInt(Field(39, 4));
Dest(DEST, UInt(Field(22, 6)), UInt(Field(32, 2)), Bit(51), 1, 7);
Src12(SRC1, UInt(Field(6, 6)), UInt(Field(30, 2)), Bit(49), 1, 7);
Src12(SRC2, UInt(Field(0, 6)), UInt(Field(28, 2)), Bit(48), 1, 7);
SetFlags(SRC1, Modifier(UInt(Field(37, 2))));
if Bit(36) == 1 then SetFlags(SRC2, F_ABS);
SetType(DEST, type);
SetType(SRC1, type);
SetType(SRC2, type);
Swizzle4(SRC1, UInt(Field(53, 2) @ Field(50, 1) @ Field(34, 2) @ Field(15, 7)));
Vec34Swizzle(SRC2, UInt(Field(44, 4)), 0, 2);
let source_mask = if alu == 7 then 15 else mask;
Load(A, SRC1, source_mask, 0);
Load(B, SRC2, source_mask, 0);
if Failed() then throw(Stop());
Reset(R, Count(A), K_FLOAT);
if alu != 7 then {
    foreach (i from 0 to Count(A) - 1) {
        let a = At(A, i);
        let b = At(B, i);
        Put(R, i, match alu { 0 => FMul(a, b), 1 => FAdd(a, b), 2 => FSub(a, FRound(1, b)), 3 => FDdx(a),
                              4 => FDdy(a), 5 => FMin(a, b), _ => FMax(a, b) })
    }
} else {
    var sum : bits(32) = FMul(At(A, 0), At(B, 0));
    foreach (i from 1 to Count(A) - 1) { sum = FFma(At(A, i), At(B, i), sum) };
    Reset(R, Popcount4(mask), K_FLOAT);
    foreach (i from 0 to Popcount4(mask) - 1) Put(R, i, sum)
};
Store(DEST, R, mask, 0)

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).