VDP

Vector float instructions

fixed bit field field the encoding fixes should be

Encoding

6362616059585756555453525150494847464544434241403938373635343332
00011predskipinvclip_plane_enable0opcode2dest_extendsrc1_extrepeat_modegpi0_absrepeat_countnoschedmasksrc1_negsrc1_absclip_plane_ndest_bank
313029282726252423222120191817161514131211109876543210
src1_bankgpi0_ndest_ngpi0_swizsrc1_swiz_wsrc1_swiz_zsrc1_swiz_ysrc1_swiz_xsrc1_n

bits 63:0: 0001 1xxx xx0x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx

Runs execute_VDP with Form() 0.

Fields

FieldBitsThe Sail reads it in
pred58:56
skipinv55
clip_plane_enable54
opcode252Bit(52)
dest_ext51Bit(51)
end50
src1_ext49Bit(49)
repeat_mode48:47execute_VDP
gpi0_abs46Bit(46)
repeat_count45:44execute_VDP
nosched43
mask42:39execute_VDP
src1_neg38Bit(38)
src1_abs37Bit(37)
clip_plane_n36:34
dest_bank33:32execute_VDP
src1_bank31:30execute_VDP
gpi0_n29:28execute_VDP
dest_n27:22execute_VDP
gpi0_swiz21:18execute_VDP
src1_swiz_w17:15execute_VDP
src1_swiz_z14:12execute_VDP
src1_swiz_y11:9execute_VDP
src1_swiz_x8:6execute_VDP
src1_n5:0execute_VDP

Operation Sail

VDP: the dot product of src1 (its channels each named, its modifiers) and the GPI register gpi0, of three components (vec4: four), into the one component the mask names, which turns a component on each repeat

let type = if Bit(52) == 1 then 2 else 1;
let source_mask = if Bit(52) == 1 then 15 else 7;
let mode = UInt(Field(47, 2));
Src12(SRC1, UInt(Field(0, 6)), UInt(Field(30, 2)), Bit(49), 1, 7);
Dest(DEST, UInt(Field(22, 6)), UInt(Field(32, 2)), Bit(51), 1, 7);
Internal(SRC2, UInt(Field(28, 2)), F_GPI, T_F32);
Vec34Swizzle(SRC2, UInt(Field(18, 4)), 0, type);
SetSwizzle(SRC1, UInt(Field(6, 3)), UInt(Field(9, 3)), UInt(Field(12, 3)), UInt(Field(15, 3)));
AddFlags(SRC1, F_NEG * Bit(38) + F_ABS * Bit(37));
if Bit(46) == 1 then AddFlags(SRC2, F_ABS);
var mask : int = UInt(Field(39, 4));
foreach (r from 0 to UInt(Field(44, 2))) {
    if not_bool(Failed()) then {
        Load(A, SRC1, source_mask, Rep(SRC1, r, O_SRC1, mode));
        Load(B, SRC2, source_mask, Rep(SRC2, r, O_SRC2, mode));
        if not_bool(Failed()) then {
            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, 1, K_FLOAT);
            Put(R, 0, sum);
            Store(DEST, R, mask, 0);
            mask = MOD(mask * 2 + DIV(mask, 8), 16)
        }
    }
}

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